Answer the question
In order to leave comments, you need to log in
Error in Xcode “invalid redeclaration of str, how to fix or what is the reason?
Hello, I apologize in advance for the stupid question.
I study quietly Xcode, I take one course on YouTube.
The presenter has an expression
var str = "text"
However, I get an error invalid redeclaration of str
What could be the problem?
If you write var str1 - there is no error, but as I understand it correctly - the variable str1 is being assigned
Answer the question
In order to leave comments, you need to log in
you most likely declared a variable with the same name twice.
By declaring a variable I mean a construction of the form:var someName = ...
That's right, you are creating the "str" variable at a time when you have already created this variable.
If you want to change the str variable, then you need to remove "var", because this keyword creates a variable
, or, if you still want to create a variable, then you need to specify a name that was not previously used in the code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question