PC SOFT

WINDEV的在线文档

  • Other statements used to exit from a loop or from a procedure
  • Using the RETURN keyword to return a value
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

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版本和更高版本
WinDevWindows Store apps This feature is available in Windows Store apps mode.
18新版本
WinDevWindows Store apps This feature is available in Windows Store apps mode.
WinDevWindows Store apps This feature is available in Windows Store apps mode.

语法

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:

如果返回=1,那么...

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:

如果返回=1,那么...

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:

如果返回=1,那么...

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).