I’m working on a program, and everything compiles and runs fine. But the second that I paste:
char letter = 'F';
switch(letter) {
case 'F':
println("F");
break;
case 'S':
println("S");
break;
}
It suddenly throws an error saying
Missing left curly bracket, "{"
right after the char letter = 'B';
Even though there is literally no missing curly bracket. Apparently, this solves it:
char letter = 'F';{
switch(letter) {
case 'F':
println("F");
break;
case 'S':
println("S");
break;}
}
I have literally no idea how there was a missing curly bracket in the first place and why placing those two curly brackets fixes the error and the program compiles fine.
Anyone able to help? Thanks