[fpc-pascal] else and otherwise in a case statement

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Dec 12 08:17:13 CET 2014


Ewald wrote:
> On 12/11/2014 11:13 PM, Howard Page-Clark wrote:
>> On 11/12/2014 21:07, Mark Morgan Lloyd wrote:
>>> I've been doing a bulk replace of 'case..else' to 'case..otherwise' to
>>> eliminate possible ambiguities that have bitten me in the past, and have
>>> noticed something interesting under 2.6.4 on x86 Linux.
>> How can "else" be ambiguous within a case statement?
> 
> If one omits the trailing semicolon (the one that's commented), the else
> becomes ambiguous:
> 
> Case Something of
>     Value1: ;
>     Value2: If Condition Then DoSomething (*;*)
> Else
> End;

Yes, that's the one. When I raised it it was pointed out to me that the 
  otherwise  form was intended as a drop-in replacement to avoid this.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list