EXIT

Terminate a BEGIN-END block

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
EXIT [label]

label

(optional) A label on a BEGIN statement for a BEGIN-END block in which the EXIT statement is contained.

The EXIT statement is specified within a BEGIN-END block and transfers control to the END statement of the current BEGIN-END block.

The optional label format is useful in a BEGIN-END block nested within another BEGIN-END block. The label enables you to exit the outer BEGIN-END block by referring to the label of that BEGIN statement.

The following example receives a message from the Synergy message manager. If the destructive receive flag is true, the message is deleted from the message pool. See NEXTLOOP for an example that demonstrates the difference between the NEXTLOOP, EXITLOOP, and EXIT statements.

subroutine chk_msg
    a_dstflg    ,d                      ;Destructive receive flag
record
    msg         ,a80
    len         ,d3,            -1
proc
    if (a_dstflg) then
      begin
        recv(msg, none1)                ;Receive and delete message
        writes(TTCHN, msg)
        exit
    none1,
        writes(TTCHN, "No messages")
      end
    else
      begin
        recv(msg, none2, "[SELF]", len)
        writes(TTCHN, msg)
        exit
    none2,
        write(TTCHN, "No messages")
      end
    xreturn
endsubroutine