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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to