Page 1 of 1

Exit mid-loop

Posted: Fri Apr 01, 2011 12:15 pm
by Helpdesk
What is the 'correct' way to exit a REPEAT...UNTIL loop?

Code: Select all

REPEAT
  ...
  ...
  IF Error THEN exit;    (* Leave the room NOW!! *)
  ....
  ....
UNTIL ...
Not appropriate to check at the beginning of the loop as Error hasn't yet
occurred.
Can't continue with the loop to UNTIL as I have an Error.

Re: Exit mid-loop

Posted: Fri Apr 01, 2011 12:43 pm
by cfbsoftware

Code: Select all

  REPEAT
    ...
    IF ~error THEN
      ...
    END
  UNTIL ... OR error;