I have a list with a drop down menu and each selection effects multiple variables.
is there any way to refine it down? here is a snippet:
if (selectedLeft == 'item 1')
row1Vis = false;
if (selectedLeft == 'item 1')
leftCounter = false;
if (selectedLeft == 'item 1')
leftNA = true;
is it possible to have it something like,
if (selectedLeft == ‘item 1’)
row1Vis = false, leftCounter = false, leftNA = true;
so i don’t have to write out if (selectedLeft == ‘item 1’) 3 times.
cheers
2
Answers
You can use body
(){...}
More about if-and-else , switch-and-case on language-tour
You can use the
if
body for your variable and also use&&
,||
if you want to use two or more conditions.&&
meansAND
,||
meansOR
: