Switch versus if/then/else ( was: Main menu puzzle, Klaus)

Mark Wieder mwieder at ahsoftware.net
Sun Feb 19 13:27:13 CST 2006


Judy-

Sunday, February 19, 2006, 10:37:36 AM, you wrote:

> Right, again, my argument was less "IF-THENs rule and CASE-SWITCHes suck"
> than IF-THENs are easier to read/learn/are more transparent for
> non/novice-programmers.

I agree that one should learn if/then conditionals before switch/case
structures. But I think one should learn if/thens before elses as
well. You can certainly do any conditional processing without else
statements, but I think it would be unwise to say that it's easier to
code and read code written without else statements.

Switch statements are the equivalent of multiple-choice questions on
an exam. You could code them as many if/then statements, but they lend
themselves naturally (IMO) to switch/case statements.

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list