[comp.sys.mac.hypercard] Another pseudo-case statement in HyperTalk

ford@sei.cmu.edu (Gary Ford) (06/07/91)

For certain kinds of case constructs, such as using single keystrokes 
to invoke a variety of actions, this script can be used:

on keyDown key
  if "a" <= key and key <= "z" then
    do "Key" & key
  else
    pass keyDown
  end if
end keyDown

on Keya
  -- do "a" actions
end Keya

on Keyb
  -- do "b" actions
end Keyb

...

on Keyz
  -- do "z" actions
end Keyz

I can't comment on the relative speed of this versus the long "if-then-
else if-else if- ... -end if" constructs previously suggested.

Gary Ford
Software Engineering Institute
Carnegie Mellon University