I get expected initializer before ‘myString’ even I defined it in setup
void setup() {
// put your setup code here, to run once:
String myString
}
void loop()
myString = "Hello"
print myString + " World"
}
I don’t know what to try.
>Solution :
The variable myString is declared inside of the setup function, and when that function ends, the variable no longer ‘exists’ so to speak. it is ‘out of scope’ as the other commenter says.
You can either choose to declare it outside of any functions, (preferably near the top of the file), in the so called ‘global scope’, or inside the loop function, so called ‘local scope’.