PC SOFT

WINDEV的在线文档

  • Code to run
  • Exiting from a loop
  • Running the next iteration
  • Loop without end
  • External variable in a loop
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系: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 block is repeated endlessly. The number of iterations in the statement block is not checked, there is no expression to evaluate.

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.
例子
// Exit according to an IF condition
循环
// Read a line in the text file
ALine文件读一行FileNum
如果ALine定界符,那么跳出
ProcessLineALine
结束

// Exit according to a WHILE condition
循环
// Read a line in the text file
ALine文件读一行FileNum
ProcessLineALine
执行只要ALine不等于定界符

// Exit according to an iteration
循环(10
// Read a line in the text file
ALine文件读一行FileNum
ProcessLineALine
结束

语法

Loop with exit according to an "IF" condition 隐藏详细信息

 循环
   ...
   IF <Condition> THEN BREAK
   ...
END

<LOOP>:
Marks the beginning of the statement block.
<BREAK>:
Used to exit from the statement block.
<END>:
Marks the end of the statement block.

Loop with exit according to a "WHILE" condition 隐藏详细信息

 循环
...
DO WHILE <Condition>

<LOOP>:
Marks the beginning of the statement block.
<DO WHILE>:
Marks the end of the statement block. Used to exit from the statement block. The lines of the loop found before this statement are run.

Loop with exit according to the number of iterations 隐藏详细信息

 循环 (<Number of Iterations>)
...
END

<LOOP>:
Marks the beginning of the statement block.
<Number of Iterations>:
Number of iterations to perform. The program will exit the loop when the number of iterations has been reached.
<END>:
Marks the end of the statement block.

注意

Code to run

The code to run is found between the 循环 and 结束 statements.

Exiting from a loop

Several statements are available:关闭 is used to exit from the loop and to close the current window.

Caution: 返回 statement and 返回 statement cannot be used in the same process.

Running the next iteration

To directly run the next iteration without ending the code of the next iteration, use the 继续 statement / "继续:" label statement:

LOOP
...
IF <Condition> THEN  CONTINUE // Go back to the LOOP keyword
...
END

Loop without end

During the compilation of the project, an endless loop (no 跳出 statement/"跳出:" label, 返回 statement or 返回 statement statement) is signaled by a warning.

External variable in a loop

A variable declared by the Extern keyword cannot be used in a loop.