penahill
8th September 2016, 23:21
I am new to LN coding but am a seasoned programmer is other languages. I am familiar with using case but I can only find ON CASE syntax. In the other languages they use a case statement very similar syntax SQL case statements. Is this type of Case available in LN in program scripts?

Example:
CASE
WHEN x = 1 and y = 1
do something
break
WHEN y = 1
do something
break
OTHERWISE
do something
break
END CASE

Thank you in advance.

Paul

mark_h
9th September 2016, 03:13
Well you can nest case statements to get something like that.

on case x
case 1:
message "x was 1 so no test on y"
break
default:
on case y
case "1":
message "x is not 1 and y is 1"
break
default :
message "x is not 1 and y is not 1"
endcase
endcase

Now if you want something with 4 or 5 variables to check then it would become cumbersome. Not even sure I have ever gone 3 levels deep.

vamsi_gujjula
9th September 2016, 13:35
its possible in LN .. but you need to undefine a macro .. prior using it

#undef end()