
Issues with switch statement sintaxe
I'm running NINOX on a Mac.
Trying to understand the syntax of switch statment I wrote the following simple Switch which works fine on the console:
let Total := 0 ;
let x := [1, 2, 3, 4, 5] ;
for p in x do
switch p do
case 1:
"Case 1 selected"
case 2:
"Case 2 selected"
end
end ;
I get the following on the Output Panel which is ok:
"Case 1 selected"
"Case 2 selected"
I want to add more code to the case statments but then I get error messages and I do not understand why.
For instance if I add a simple line of code to case 2 like the following:
let Total := 0 ;
let x := [1, 2, 3, 4, 5] ;
for p in x do
switch p do
case 1:
"Case 1 selected"
case 2:
"Case 2 selected"
Total := Total + 2 ;
end
end ;
I get an error message "symbol expected at line 10" (the new added line).
If I add a semicolon to the first line o case 2, I get the same error message, now for line 9.
What am I missing?
-
I'm running Ninox version 3.5.8
I tried to follow your suggestion but couldn't get the parentheses inserted automatically.
By the way, if in a case you insert more than one command line without parentheses, Ninox immediately gives an error message.
With error messages, clicking the OK button, nothing happens.
The error has to be eliminated first in order to be able to close the window by clicking OK.
Also on the console we don't have the OK button.