I have occasionally had ambiguity with ELSE, for example when you have IF statements nested inside other IF statements, sometimes the ELSE is seen as part of the inner, not the outer, or vice versa, depending on where the one-liners are but I just resolve it with some BEGIN - END Blocks, even if they are not actually needed because there is only one line, ambiguity resolved.
For years I have just been in the habit of always putting BEGIN and END on all IF and ELSE statements, as well as all entries of CASE statements, whether needed or not, just because it's so much easier to stick in some temporary diagnostic code if needed, it's easier to just always have them and not have to add them later if you want to do a second thing, which always seems to be happening. I guess that's why I never noticed there could be an issue with CASE statements. It is handy to know about OTHERWISE though, I'll probably throw it in just to help remind me that this belongs to the CASE Statement, and not part of some IF, maybe it will be more readable that way. James -----Original Message----- From: fpc-pascal <fpc-pascal-boun...@lists.freepascal.org> On Behalf Of Martin Wynne via fpc-pascal Sent: Thursday, December 14, 2023 3:16 PM To: fpc-pascal@lists.freepascal.org Cc: Martin Wynne <mar...@85a.uk> Subject: Re: [fpc-pascal] case statement I've been using ELSE in IF statements and in CASE statements for 25 years without realising there was a problem. What a dim-wit I have been. Martin. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal