====== EXIT ====== ===== exit_statement ===== [ label : ] exit [ 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 cases the loops are left with the **EXIT** -statement if //value = 0// . In the first example this is achieved by a conditional **EXIT** -statement, whereas in the second example an unconditional **EXIT** -statement has been integrated into an **IF** -loop. LOOP EXIT WHEN value = 0 ; tab( value ) := value REM 2 ; value := value / 2 ; END LOOP ; LOOP IF value = 0 THEN EXIT ; END IF ; tab( value ) := value REM 2 ; value := value / 2 ; END LOOP ; ---- These are two examples of chained **FOR** -loops which are need to calculate the values of the elements of a two-dimensional array. In the first example the inner loop is left if //i = j// . In the second example the outer loop is left if //i = j// . lbl_1 : FOR i IN 10 DOWNTO 2 LOOP lbl_2 : FOR j IN 0 TO i LOOP EXIT 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 EXIT lbl_1 WHEN i = j ; table ( i, j ) := i + j - 7 ; END LOOP lbl_2 ; END LOOP lbl_1 ;