[fpc-pascal] Value of runner variable after a for loop
Flávio Etrusco
flavio.etrusco at gmail.com
Mon Mar 12 16:19:26 CET 2007
On 3/12/07, Michael Van Canneyt <michael.vancanneyt at wisa.be> wrote:
>
> On Mon, 12 Mar 2007, Luiz Americo Pereira Camara wrote:
>
> > Take the following example:
> >
> > for i:= 0 to 2 do;
> > WriteLn(i);
> >
> > Can i safely assume that after the for loop the value of "i" is 2?
>
> No. I think it is even specified in the pascal standard.
>
And unless the compiler (programmer) use an extra variable just to
attain this behaviour, the value after the loop will 3 (i.e. end value
+1).
-Flávio
More information about the fpc-pascal
mailing list