8.10 NEXT

...
ENTITY e IS
    ...
BEGIN
    ...
END e ;

...
ARCHITECTURE a OF e IS
    ...
BEGIN
    ...
END a ;

...
CONFIGURATION c
        OF e IS
    ...
    ...
    ...
END

...
PACKAGE pkg IS
    ...
    ...
    ...
END pkg ;


next_statement ::=
[ label : ]
next [ loop _label ] [ when condition ] ;

..
PACKAGE BODY pck
        IS
    ...
    ...
    ...
END pck ;

...
b: BLOCK IS
    ...
BEGIN
    ...
END BLOCK b ;

FUNCTION f (...)
    RETURN r IS
    ...
BEGIN
    ...
END f ;

PROCEDURE p (...) IS
    ...
BEGIN
    ...
END p ;

p : PROCESS
    ...
BEGIN
    ...
END PROCESS p ;

8.10.1 Further definitions

label ::= identifier

condition ::= boolean _expression

8.10.2 Examples

WHILE value > 0 LOOP
   NEXT WHEN value = 3 ;
   tab( value ) := value REM 2 ;
   value := value / 2 ;
END LOOP ;

In both examples the statements following the
NEXT -statement are ignored if value = 3 .


In the first example this is achieved by a conditional
NEXT -statement, whereas in the second example an
unconditional NEXT -statement has been integrated
into an IF -loop.

WHILE value > 0 LOOP
   IF value = 3 THEN NEXT ;
   END IF ;
   tab( value ) := value REM 2 ;
   value := value / 2 ;
END LOOP ;
lbl_1 : FOR i IN 10 DOWNTO 2 LOOP
   lbl_2 : FOR j IN 0 TO i LOOP
      NEXT lbl_2 WHEN i = j ;
      table ( i, j ) := i + j - 7 ;
   END LOOP lbl_2 ;
END LOOP lbl_1 ;

These are two examples of chained
FOR -loops which are needed to calculate the
values of the elements of a two-dimensional array.

In the first example the succeeding statements
for the inner loop are ignored if i = j.

In the second example the process is continued with
the next passage of the external loop if i = j .

lbl_1 : FOR i IN 10 DOWNTO 2 LOOP
   lbl_2 : FOR j IN 0 TO i LOOP
      NEXT lbl_1 WHEN i = j ;
      table ( i, j ) := i + j - 7 ;
   END LOOP lbl_2 ;
END LOOP lbl_1 ;