exit
The EGL exit statement leaves the specified block, which by default is the block that immediately contains the exit statement.
- case
- Leaves the most recently entered case statement in which the exit statement resides. Continues processing after the case statement.
An error occurs if the exit statement is not inside a case statement that begins in the same function.
- for
- Leaves the most recently entered for statement in which the exit statement resides. Continues processing after the for statement.
An error occurs if the exit statement is not inside a for statement that begins in the same function.
- forEach
- Leaves the most recently entered forEach statement in which the exit statement resides. Continues processing after the forEach statement.
An error occurs if the exit statement is not inside a forEach statement that begins in the same function.
- if
- Leaves the most recently entered if statement in which the exit statement resides. Continues processing after the if statement.
An error occurs if the exit statement is not inside an if statement that begins in the same function.
- program
- Leaves the program.
The value in the system variable sysVar.returnCode is returned to the operating system in any of the following cases:
- The program ends with an exit statement that does not include a return code
- The program ends with an exit statement that returns sysVar.returnCode
- The program ends without a terminating exit statement
If the program ends with a terminating exit statement that includes a return code other than sysVar.returnCode, the specified value is used in place of any value that may be in sysVar.returnCode.
- returnValue
- A literal integer or an item, constant, or numeric expression that resolves to an integer. The return value is made available to the operating system and must be in the range of -2147483648 to 2147483647, inclusive.
For other details on return values, see sysVar.returnCode.
- sysVar.returnCode
- The system variable that includes the value returned to the operating system.
For details, see sysVar.returnCode.
- stack
- Returns control to the main function without setting a return value for the current function.
A statement of the form exit stack removes all references to the intermediate functions in the run-time stack, which is a list of functions; specifically, the current function plus the series of functions whose running made possible the running of the current function.
The main function may have invoked a function (now in the stack), and the invocation may have included a parameter that had the modifier out or inOut. In those cases, the exit statement of the form exit stack makes the value of the parameters available to the main function.
If you do not specify a label (as described later), processing continues at the statement after the most recently run function invocation in the main function. If you specify a label, processing continues at the statement that follows the label in the main function. The label may precede or follow the most recently run function invocation in the main function.
If you specify an exit statement of the form exit stack in the main function, the next statement is processed, even if you specify a label. For details on how to go to a specified label in the current function, see goTo.
- label
- A series of characters that are displayed in the main function and outside of any blocks, including these:
- if
- else
- inside a case statement
- while
- try
When displayed at the location where processing continues, the label is followed by colon. For details on valid characters for the label, see Naming conventions.
Related reference
goTo
Naming conventions
sysVar.returnCode