Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!scasterg From: scasterg@magnus.acs.ohio-state.edu (Stuart M Castergine) Newsgroups: comp.sys.mac.hypercard Subject: Re: Why no 'case' statement in Hypertalk? Suggestions? Message-ID: <1991Jun7.173856.7012@magnus.acs.ohio-state.edu> Date: 7 Jun 91 17:38:56 GMT References: <55655@nigel.ee.udel.edu> Sender: news@magnus.acs.ohio-state.edu Organization: The Ohio State University Lines: 23 Nntp-Posting-Host: bottom.magnus.acs.ohio-state.edu In article <55655@nigel.ee.udel.edu> johnston@oscar.ccm.udel.edu writes: >Still simpler (forget all the else statements): > >on keyDown key > if key is "a" then beep > if key is "b" then beep 2 > if key is "c" then beep 3 > pass keyDown >end keyDown > >Bill (johnston@minnie.me.udel.edu) But much slower -- you force the script to evaluate all the expressions, which is time-consuming if there are very many. If you insert else statements, flow will exit the construct after it finds a condition that tests true, saving you many needless expression evaluations. -- scasterg@magnus.acs.ohio-state.edu Stuart M Castergine "Step by step they were led to practices which disposed to vice -- the lounge, the bath, the elegant banquet. All this in their ignorance they called civilisation, when it was but part of their servitude."