Matching multiple cases in a switch
Posted: Wed Aug 28, 2013 8:03 pm
Let's say I have the following:
The switch will never execute the second case script because the switch exits once the first condition is satisfied. If I want each condition to be checked, should I just do standalone if statements? like:
Or is there a better way to do that?
Code: Select all
set the cColor of btn "btn1" to "blue"
set the cShape of btn "btn1" to "round"
switch
case the cColor of btn "btn1" is "blue"
answer "it's blue"
break
case the cShape of btn "btn1" is "round"
answer "it's round"
break
default
answer "It's neither blue nor round"
end switch
Code: Select all
if the cColor of btn "btn1" is "blue" then answer "it's blue"
if the cShape of btn "btn1" is "round" then answer "it's round"