Skip to main content
Previous section   Next section

EXIT

Exits a LOOP...REPEAT or FOR...NEXT statement.

Synopsis

EXIT

Arguments

The EXIT statement takes no arguments.

Description

The EXIT statement can only be used within a LOOP...REPEAT or FOR...NEXT control structure to provide an alternate way to exit the loop. EXIT transfers control to the statement immediately following the end of the loop structure (the NEXT or REPEAT keyword).

Any number of EXIT statements may be placed anywhere in the block of code statements. EXIT is commonly used with the evaluation of some condition (such as an IF...THEN statement).

When used within nested loop statements,EXIT only exits the loop in which it occurs; EXIT transfers control to the loop that is nested one level above the exited loop.

The GOTO statement can also be used to exit from a loop control structure. The CONTINUE statement exits from the current iteration of a loop; the EXIT statement exits from the loop.

Emulation

In jBASE emulation mode, EXIT has both an argumentless and an argumented form.

  • EXIT without an argument is used to exit a loop, as described above. The keyword BREAK without an argument can also be used for this purpose.

  • EXIT with an argument is used to exit a program and return the argument value. The argument is commonly an integer code value.

See Also