====== NEXT ======
===== next_statement =====
[ label : ] next [ loop _label ] [ when condition ] ;
===== Parents =====
* function_statement_part
* procedure_statement_part
* process_statement_part
===== Further definitions =====
==== label ====
* [[.:bnf#identifier]]
==== condition ====
''//boolean// _[[.:bnf#expression]]''
===== Examples =====
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
NEXT WHEN value = 3 ;
tab( value ) := value REM 2 ;
value := value / 2 ;
END LOOP ;
WHILE value > 0 LOOP
IF value = 3 THEN NEXT ;
END IF ;
tab( value ) := value REM 2 ;
value := value / 2 ;
END LOOP ;
----
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_2 WHEN i = j ;
table ( i, j ) := i + j - 7 ;
END LOOP lbl_2 ;
END LOOP lbl_1 ;
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 ;