Syntax Error

I have a syntax error and I have no clue why.

You have a default: but no break;

Technically you don’t even need to put a break in there because it’s the last of the switch cases, but you will need to put something in there to satisfy the compiler. Even a simple ; would do the trick, but if you don’t have anything to execute in the default it might be wise to do what Chris suggested and go with a break statement. It will make your code easier to read.

Privacy & Terms