[fpc-devel] Multiple variable initialization

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Mar 24 15:59:04 CET 2018


On Sat, 24 Mar 2018 15:41:15 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:

> On Sat, 24 Mar 2018, Ondrej Pokorny wrote:
> 
> > Is there a reason why multiple variable initialization is forbidden?
> >
> > program Test;
> > var
> >   A: Integer = 0;    // allowed
> >   B, C: Integer = 0; // not allowed  
> 
> I think this is confusing to read. 
> Are B and C both initialized, or only B ?

The "integer" is applied to both. It would be inconsistent to apply the
=0 only to C.

 
> Javascript also does not allow this, I think, and for once with good reason.

Since when is JS a role model for Pascal?

Mattias



More information about the fpc-devel mailing list