Using the switch statement in the way of your example requires the 'case' parts to return true, and it's basically the same as the if option you presented.
I would recommend using the switch based on a specific factor like this:
Code: Select all
switch the cColor of btn "btn1"
case "blue"
put "it's blue" into coltxt
break
case "red"
put "it's red" into coltxt
break
default
put "" into coltxt
end switch
switch the cShape of btn "btn1"
case "round"
put "it's round" into shptxt
break
default
put "" into shptxt
end switch
if coltxt is not empty then
put coltxt after output
end if
if shptxt is not empty then
if output is not empty then put comma&space after output
put shptxt after output
end if
if output is empty then put "There is no colour or shape" into output
answer output
That's a lot longer, but very flexible when there are a lot of choices. If there are only a few choices though - then a bunch of if statements is likely to be easier to handle.
It all depends on what you are trying to achieve.
Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.