[fpc-devel] Declare variables inside the code

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed May 11 12:28:29 CEST 2011


Joerg Schuelke schrieb:
> Am Tue, 10 May 2011 23:50:29 +0200
> schrieb Hans-Peter Diettrich <DrDiettrich1 at aol.com>:
> 
>> The syntax would look like:
>>
>> Block = "BEGIN" [Declarations] {Statement} "END" .
> 
> Yea, it looks like C, but it is not. The difference in C like languages
> is that an declaration is just a kind of statement.

Not really. C allows for variable declarations outside blocks, too, as 
Pascal does. Otherwise a declaration list is accepted only at the 
*begin* of a compound statement, not inside a statement list:

compound_stat: '{' [decl_list] [stat_list] '}' ;

DoDi




More information about the fpc-devel mailing list