Weird Missing Left Curly Bracket Error

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

1 Like

i tested both of your code here ( processing IDE 3.5.3 )
and both OK.

there is some nice help:

++ readability
please use
[ctrl][t]
to format your code

++ block indication
please position your cursor behind the ‘{’
and the editor shows you its related ending ‘}’ like with ‘[ } ]’

1 Like

Oh I’m using 3.3.7, that makes sense. I guess I’ll have to update. Also thanks for the tips!