Next

LRM §8.10.

The next statement is used to complete execution of one of the iterations of an enclosing loop statement, making it jump back to the top of that loop. The completion is conditional if the statement includes a condition.

Syntax:

[ label: ] next [ loop_label ] [ when condition ];

Description:

The next statement allows to skip a part of an iteration loop. If the condition specified after the when reserved word is true, or if there is no condition at all, then the statement is executed. This results in skipping all statements below it until the end of the loop and passing the control to the first statement in the next iteration.

A next statement may specify the name of the loop it is expected to influence. If no label is supported then the statement applies to the innermost enclosing loop.

Example:

L1: loop 
  k:= 0;
  L2: for CountValue in 1 to 8 loop
    next when CountValue = N;    -- jump to next itteration of loop L2
    if A(k):= 'U' then
      next L1;                   -- jump to top of loop L1
    end if;
    k:= k + 1;
  end loop L2;
end loop L1;

Note:

See also:

Exit, For loop, Loop, While loop