[fpc-pascal] Illegal counter variable?

Martin Wynne martin at templot.com
Mon Sep 9 14:53:27 CEST 2019


On 09/09/2019 13:38, James Richters wrote:
> Var
>     I:Byte;
> Begin
>    I:=57;
>    For I := I to 100 do
>      Begin
>         If I=87 then
>            I:=95;
>         Write(I,' ');
>      End;
> End.

Why not:

Var
     I:Byte;
Begin
    I:=57;
    For I := I to 100 do
      Begin
         If (I>86) And (I<95) then Continue;
         Write(I,' ');
      End;
End.

which is much easier to follow the logic.

cheers,

Martin.


More information about the fpc-pascal mailing list