Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Could someone help me with the correct syntax for Switch statement?
I have read through the forum threads on Switch statement but there doesn't seem to be any error free syntax.
Thanks,
DK
Well the normal syntax is
switch variable
case 1
case 2
end switch
What do you need else regarding switch feature ?
Rgds,
Sébastien
Hi Sebastien,
Thanks for that.
I have applied the syntax as you have given. But the above syntax doesnt work. It returns a 'Line Error' and I know that I have not made any other mistakes in the query.
dk
Coud you paste the copy of the script ?
Hi,
Do you end your case statements with semicolon?
switch expr
case first_possible_value_of_expr
do something;
case second_possible_value_of_expr
do something else;
default
do otherwise;
end switch
Is your "do something" statements length more than one line?
Here is a simple example which works:
let
expr =2;
switch
expr
case
2
TOTO:
LOAD
* INLINE[
;
default
TOTO:
LOAD
* INLINE[
;
end
switch