Main menu puzzle, Klaus
Garrett Hylltun
garrett at paraboliclogic.com
Sat Feb 18 14:38:55 EST 2006
On Feb 18, 2006, at 10:43 AM, Judy Perry wrote:
> Hi Eric,
>
> I do think that Ken IS making effort. Lots of effort. He is doing
> us and
> the company a favor by showing exactly what it is (in this particular
> situation) that absolutely bedevils newcommers who are not
> programmers.
>
> Case statements and pWhich's simply are NOT comprehensible to
> non-programmers!
I myself avoid Case statements completely and end up replacing them
with If statements. I've been programming since about 1996ish, using
either a basic or scripting language, and even in those, I've always
seemed to avoid Case.
Not sure why either, just didn't like Case and always found an
alternative to it.
I recently uploaded to the user spaces a text editor example that I
made to learn Rev. In it you'll see that for the menu bar and a
popup menu that I completely dumped the case statements and replaced
them all with if statements.
on menuPick varMenuItemSelected
if varMenuItemSelected is "Cut" then
SubCut
else if varMenuItemSelected is "Copy" then
SubCopy
else if varMenuItemSelected is "Paste" then
SubPaste
else if varMenuItemSelected is "Undo" then
SubUndo
else if varMenuItemSelected is "Word Wrap" then
SubWordWrap
end if
end menuPick
I wouldn't go so far as to say I'm a real experienced programmer, but
enough brains left in my head that I am capable of getting something
done (when the A.D.D. isn't screwing with me).
And to this day, I just don't understand the whole purpose of the
Case statement..... Still don't even after reading a few of the
replies to this thread.
And I think another thing, a bit odd I'm sure, but I find the Case
statements to be... well... Ugly for some reason. Just looking at
code for a Case statement doesn't seem to flow naturally in my mind,
but an equivalent If statement does. Don't ask me why! Could be
that I'm just a seriously odd fellow ;-)
-Garrett
P.S. BOYCOTT CASE STATEMENTS! IF STATEMENTS ROCK!
More information about the use-livecode
mailing list