1. Re: Short Circuiting
- Posted by Robert B Pilkington <bpilkington at JUNO.COM> Jun 24, 1998
- 510 views
>2. Further, there may be other elsifs to perform (amended example), so >moving the logic of [gamma] to [beta] is not practical. > >My point (again) is NOT to say that these cases cannot be solved. I >was >trying to point out that the requirement to test ranges before testing >values often leads to convoluted test, and that perhaps a better >solution than short-circuiting would be to offer some 'safer' >routines. > >-- David Cuny > > -- for anyone who cares, here's a way ugly solution. > -- it breaks the if into multiple if..end if's, and > -- uses a flag to cause only one block to be executed > And here's a real solution. :) if match("EOF", s) = 1 then [alpha] else [gamma] end if If the first 3 letters are EOF, then do alpha, otherwise, do gamma. My first attempt used find(), and won't work. Also, if it had match() instead, it still wouldn't work like you wanted since it didn't have =1 (If it found it at all it would do alpha.) Remove the = 1 to have it always work if it finds EOF anywhere in s. See, simple. :) _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]