Examples of Labels

The following example illustrates a statement label called increment_x within an SPL routine:
DEFINE x INT;
LET x = 0;
BEGIN
        <<increment_x>>
        BEGIN
                LET x = x + 1;
        END;
        IF x < 10 THEN
                GOTO increment_x;
        END IF;
END;
END  PROCEDURE;
The following program fragment shows an example of a labeled FOR loop:
<<lb_for>>
FOR i IN 1..5 
   i := i +1 ;
END FOR lb_for;
The following program fragment illustrates a labeled loop from which an EXIT label statement can exit:
<<outer>>
LOOP
...
LOOP
...
EXIT outer WHEN ... -- exit from both loops
END LOOP;
...
END LOOP outer;

Related Statements

EXIT, FOR, GOTO, LOOP, WHILE