Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cica!iuvax!maytag!xenitec!timk From: timk@xenitec.on.ca (Tim Kuehn) Newsgroups: comp.lang.pascal Subject: Re: ELSE considered harmful :-) Message-ID: <1990Feb27.025511.12685@xenitec.on.ca> Date: 27 Feb 90 02:55:11 GMT References: <5381@daimi.dk> Reply-To: timk@xenitec.UUCP (Tim Kuehn) Organization: TDK Consulting Services, Kitchener, ON, Canada Lines: 44 In article <5381@daimi.dk> erja@daimi.dk (Erik Jacobsen) writes: > >This is a valid part of a TurboPascal 5.0-program: > > CASE n OF > 1: p := 7; > 2: p := 6; > 3: IF x = 4 THEN > p := 5; > ELSE > p := 4; > END something like part 3 of this case statement I'd write as: 3: begin if x = 4 then p := 5 else p := 4; end; As much for clarity of what's going on in the code as for catching little bugs like what hit you. >It bit me yesterday ... I would prefer if the CASE-ELSE had >been OTHERWISE. Oh well, such is life....of course, you could always invent your OWN programming language and solve the problem quite readily that way! :-) >-------------------------------------------------------------------- >Erik Jacobsen, Computer Science Department, Aarhus University >Ny Munkegade, Building 540, DK-8000 Aarhus C, Denmark +-----------------------------------------------------------------------------+ |Timothy D. Kuehn timk@xenitec.on.ca | |TDK Consulting Services !watmath!xenitec!timk | |871 Victoria St. North, Suite 217A | |Kitchener, Ontario, Canada N2B 3S4 (519)-741-3623 | |DOS/Xenix - SW/HW. uC, uP, DBMS. Quality SW Guaranteed | +-----------------------------------------------------------------------------+