The
返回 statement is used to exit from a statement block and to exit from the current process (or procedure).
The 返回 statement can be used in:
16版本和更高版本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 from the procedure (standard exit from the procedure or exit from the procedure via the RETURN keyword).
16新版本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 from the procedure (standard exit from the procedure or exit from the procedure via the RETURN keyword).
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 from the procedure (standard exit from the procedure or exit from the procedure via the RETURN keyword).
18版本和更高版本
18新版本
语法
Procedure
过程 <Procedure Name> ([<Parameter>])
IF <Condition> THEN RETURN
...
END
FOR statement
对于 <Control variable> = <Initial value> TO <Final value> [STEP <x>]
IF <Condition> THEN RETURN
END
FOR EACH statement
对于 EACH <File> ON <Key item>
IF <Condition> THEN RETURN
END
LOOP statement
循环
...
IF <Condition> THEN RETURN
...
END
WHILE statement
只要 <Condition 1>
...
IF <Condition> THEN RETURN
...
END
The following operations are performed if <Condition> is True:
- Exit from the statement block.
- Exit from the current process (or procedure).
注意
Other statements used to exit from a loop or from a procedure
Several statements are available:
- 返回 statement: Return a status report to the calling process. Exit from the loop and exit from the current process (or procedure).
- 跳出 statement/"跳出:" label: Exit from the loop and run the rest of the current process (or procedure).
关闭 is used to exit from the loop (or procedure) and to close the current window.
Caution: Caution: 返回 and 返回 statement cannot be used in the same process.
16版本和更高版本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:
...
返回=文件读一行(nFile)
文件关闭(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 the procedure
- when using the RETURN keyword to exit a process (equivalent to the 返回 statement statement).
16新版本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:
...
返回=文件读一行(nFile)
文件关闭(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 the procedure
- when using the RETURN keyword to exit a process (equivalent to the 返回 statement statement).
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:
...
返回=文件读一行(nFile)
文件关闭(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 the procedure
- when using the RETURN keyword to exit a process (equivalent to the 返回 statement statement).