Leave and restart may be used to terminate the execution of a pattern or singular object to start execution from the beginning:

Ptn: Super
   ...
      %leave Ptn
   ...
      %restart Ptn
   ...

Obj: = Super
   ...
      %leave Ptn
   ...
      %restart Ptn

   ...

Leave and restart may appear at an arbitrary nesting level within Ptn or Obj.

Note. The declarations are only executed when the object is generated -- a restart does not imply re-execution of declarations within Ptn and/or Obj.

Example

Loop: =
   i: ? integer
   i := i + 1
   foo(i)
   %if i > 10 %then %leave Loop
   bar
   %restart Loop

Comparison to Beta

In Beta a statement may be labelled - qBeta does not have labelled statements. Instead singular objects may be used as labelled statements.