|
|
|
|
|
- Other statements used to exit a loop or a procedure
- Using the RETURN keyword to return a value
RETURN statement In french: RETURN
The RETURN statement is used to exit a statement block and the current process (or procedure). The RETURN statement can be used in: In a procedure, you also have the ability to assign a value to the RETURN keyword. This value can be re-read at any time. This value will be automatically returned when exiting the procedure (standard exit from the procedure or exit from the procedure via the RETURN keyword). Syntax
Procedure
PROCEDURE <Procedure name> ([<Parameter>]) IF <Condition> THEN RETURN ... END
FOR statement
FOR <Control variable> = <Initial value> TO <Final value> [STEP <x>] IF <Condition> THEN RETURN END
FOR EACH statement
FOR EACH <File> ON <Key item> IF <Condition> THEN RETURN END
LOOP statement
LOOP ... IF <Condition> THEN RETURN ... END
WHILE statement
WHILE <Condition 1> ... IF <Condition> THEN RETURN ... END
The following operations are performed if <Condition> is True: - Exit the statement block.
- Exit the current process (or procedure).
Remarks Other statements used to exit a loop or a procedure The BREAK statement exits the loop and executes the rest of the current process (or procedure). Close is used to exit the loop (or procedure) and close the current window. Using the RETURN keyword to return a value In a procedure, you also have the ability to assign the return value before the actual exit from the procedure. For example: ... RETURN = fReadLine(nFile) fClose(nFile)
You also have the ability to re-read the value assigned by RETURN so that there is no need to declare a local variable to contain the result. For example: The value assigned to RETURN will be returned to the calling process: - at the end of procedure
- when using the RETURN keyword to exit the process (equivalent to the RETURN statement).
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|