Contents | Prev | Next | Index


Loop Statements

The purpose of a loop statement is to perform a repeated execution of a statement sequence. It is only terminated upon execution of an EXIT statement within that statement sequence.

loop_stmt  ::= LOOP stmt_seq END

Example:

LOOP
  ReadInt(i);
  IF i<0 THEN EXIT END;
  WriteInt(i)
END

Loop statements are useful to express repetitions with several exit points. They are also useful in cases where the exit condition is in the middle of the repeated statement sequence.


Contents | Prev | Next | Index

Canterbury Modula-2 for Java  (Last documentation update Feb 8, 2000)
Copyright © 1998 Mill Hill & Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to mhc@webcom.com