switch/case vs if/then/else

Klaus Major klaus at major-k.de
Sun Feb 19 11:55:11 EST 2006


Hi Mark,

> Stephen-
>
> ...
> 3. If I have a list of targets that I will probably want to expand
> then that's a candidate for a switch statement.
>
> switch itemToTest
>   case
>     "sloth"
>     "envy"
>     "gluttony"
>     put "sin" into whatIsIt
>     break
>   default
>     put "virtue" into whatIsIt
> end switch

to use the engines syntax: bad case :-)

We have to write:

...
switch itemToTest
   case "sloth"
   case "envy"
   case "gluttony"
     put "sin" into whatIsIt
...

> -Mark Wieder
>  mwieder at ahsoftware.net

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the use-livecode mailing list