PreviousNextIndex

LEAVE statement

Exits from a block. Execution continues with the first statement after the end of the block.

Syntax

LEAVE [ label ] 

label
Example

This procedure represents part of a menu program. If the user chooses N, P, F, or Q, the procedure leaves the inner choose block and goes on to process the menu selection. If the user presses any other key, the procedure rings the terminal bell.

r-leave.p
DEFINE VARIABLE valid-choice AS CHARACTER NO-UNDO INITIAL "NPFQ". 
DEFINE VARIABLE selection    AS CHARACTER NO-UNDO FORMAT "x". 
main-loop: 
REPEAT: 
  choose: 
  REPEAT ON ENDKEY UNDO choose, RETURN: 
    MESSAGE "(N)ext (P)rev (F)ind (Q)uit" 
      UPDATE selection AUTO-RETURN. 
    /* Selection was valid */ 
    IF INDEX(valid-choice, selection) <> 0 THEN LEAVE choose.  
    BELL. 
  END.  /* choose */ 
  /* Processing for menu choices N, P, F here */ 
  IF selection = "Q" THEN LEAVE main-loop. 
END. /* REPEAT */ 

See also

NEXT statement, RETURN statement, UNDO statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex