[fpc-devel] Multiple variable initialization

Ondrej Pokorny lazarus at kluug.net
Sat Mar 24 16:07:26 CET 2018


On 24.03.2018 15:41, Michael Van Canneyt 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 ?

It's not confusing at all. As Mattias said, Integer is both applied to B 
and C, so should be "= 0".

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

Well I cannot think of a good reason to disallow it :) And nobody has 
given a good reason yet.

Ondrej



More information about the fpc-devel mailing list