[fpc-devel] Semicolon before else

Juha Manninen juha.manninen at phnet.fi
Tue Jan 26 10:56:58 CET 2010


I actually suggested a similar change for Delphi years ago. Its value and 
benefit is obvious: when adding ELSE to and existing IF statement.

  if a then

must have a semicolon, but

  if a then

must NOT have a semicolon. It is irritating when you add ELSE to an existing 
IF statement and try to compile.
Or, am I the only person who has tried to do that?

I understand it brings problems with "CASE" and also with nested if 

Object Pascal is otherwise a nice language but there are few annoying syntax 
details that other languages have solved better. Three such cases pop into my 

1. This semicolon / no semicolon irritation.
2. Const array syntax. You should not need to define the upper bound. This was 
discusses in Lazarus mail list.
3. Circular references. This is the worst and it really makes this language 
less popular for big projects. There was another mail thread about it.

Juha Manninen

More information about the fpc-devel mailing list