erja@daimi.dk (Erik Jacobsen) (02/26/90)
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 What's wrong? Well, I guess you spotted it. The ELSE is an ELSE in the CASE- statement, and not in the IF-statement, as the indention suggests. And the error is the semicolon at the end of "p := 5". It bit me yesterday ... I would prefer if the CASE-ELSE had been OTHERWISE. Erik -------------------------------------------------------------------- Erik Jacobsen, Computer Science Department, Aarhus University Ny Munkegade, Building 540, DK-8000 Aarhus C, Denmark Phone: +45 86127188, Telefax: +45 86135725, Home phone: +45 86169199 Internet: erja@daimi.aau.dk, Ham-radio: OZ6KS
timk@xenitec.on.ca (Tim Kuehn) (02/27/90)
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 | +-----------------------------------------------------------------------------+
bigelow@hpfcso.HP.COM (Jim Bigelow) (03/01/90)
Not to be smug, HP Pascal chose to implement the otherwise clause for case statements rather than an "else". Jim Bigelow S300 Pascal Colorado Language Lab HP
reagan@hiyall.enet.dec.com (John R. Reagan) (03/01/90)
In article <9110013@hpfcso.HP.COM>, bigelow@hpfcso.HP.COM (Jim Bigelow) writes... >Not to be smug, HP Pascal chose to implement the otherwise clause for case >statements rather than an "else". > >Jim Bigelow >S300 Pascal >Colorado Language Lab >HP The new Extended Pascal standard has also chosen OTHERWISE for CASE statements and variant records. -John Reagan
woody@eos.UUCP (Wayne Wood) (03/06/90)
In article <9110013@hpfcso.HP.COM> bigelow@hpfcso.HP.COM (Jim Bigelow) writes: >Not to be smug, HP Pascal chose to implement the otherwise clause for case >statements rather than an "else". > yeah, and then they really fucked up with MPE... /*** woody **************************************************************** *** ...tongue tied and twisted, just an earth bound misfit, I... *** *** -- David Gilmour, Pink Floyd *** ****** woody@eos.arc.nasa.gov *** my opinions, like my mind, are my own ******/
defaria@hpclapd.HP.COM (Andy DeFaria) (03/07/90)
>/ hpclapd:comp.lang.pascal / woody@eos.UUCP (Wayne Wood) / 9:10 am Mar 5, 1990 / > >yeah, and then they really fucked up with MPE... Care to elaborate? How did they fuck up?