Main menu puzzle
Charles Hartman
charles.hartman at conncoll.edu
Sat Feb 18 16:07:15 EST 2006
On Feb 18, 2006, at 3:45 PM, Rob Cozens wrote:
> As a programmer, I see any "if" construct with more than two
> mutually exclusive alternatives as crying out for switch [case]
> syntax.
>
> Not only is it easier to comprehend the total logic flow, but
> adding new alternatives is much simpler.
As not a programmer -- as someone who finds it difficult to foresee
and pre-design all the branches I'm going to want -- I really agree
with this. The trouble with chains of "if" statements is that it's
too easy for both me and the language to get befuddled about which
"else" goes with who, and when my confusion & the language's
confusion don't match, the logic error can be really elusive and I
waste a lot of time tracking it down. The "switch" statement feels
clunkier, but as long as you don't forget a "break" (a perpetual
pitfall) you can always look at the thing and tell what it's meant to
do.
Charles
More information about the use-livecode
mailing list