0103: Expected a switch case

Compiler expected the word case or default but found something else.

Switch statement syntax only allows the code to be placed after case or default keywords. Case blocks don't require the end keyword.

Possible solutions:

switch <var>
   case <n1>, <n2>, ... <n3>
     // do something if <var> is equal to n1, n2, or n3
   case <n4>
     // do something if <var> is equal to n4
   default
     // do something if none of the values above matched the variable
end

Last updated