Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!stadler From: stadler@Apple.COM (Andy Stadler) Newsgroups: comp.sys.mac.hypercard Subject: Re: Why no 'case' statement in Hypertalk? Suggestions? Message-ID: <53709@apple.Apple.COM> Date: 6 Jun 91 18:08:29 GMT References: <1991Jun4.234844.1280@cognet.ucla.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 32 In article <1991Jun4.234844.1280@cognet.ucla.edu> earl@cogdev.cognet.ucla.edu (Earl Williams) writes: >Is there really no 'case' statement in Hypertalk, or am I missing its >equivalent? For simple keypress trapping, I'd like to do something like > > [..hypothetical case statement syntax described..] > >Instead, I have to use standard if-then-else statements which, when >formatted, give the false impression that I'm doing nesting. > >on keyDown key > if key = 'a' then do this else > if key = 'b' then do that else > if key = 'c' then do the other > end if > end if > end if >end keyDown Instead, type it like this: on keydown key if key is 'a' then dosomething else if key is 'b' then dosomethingelse else if key is 'c' then doyetanother end keydown I think this is what you want. Andy Stadler Apple Computer, Inc.