[fpc-pascal] The reason why linus torvalds hate-pascal

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Apr 17 23:19:57 CEST 2008


On 17 Apr 2008, at 21:25, Andreas Berger wrote:
> for a := 0 to x do
> for b := 0 to y do
>   for c := 0 to z do
>      if (...) then
>      begin
>          // Do something and then exit all loops
>          exit;  // Or maybe: goto OutSideOfLoops;
>      end;
>
> In Pascal I can't change the 'a' and 'b' values to force the end of  
> the loop. So what other GOOD option do I have but to use exit or goto?

Use a while or repeat loop. The whole point of a for-loop is exactly  
to have the compiler ensure (to the best of its abilities) that you do  
not accidentally modify the loop variables.


Jonas



More information about the fpc-pascal mailing list