做什么
除非满足 WHILE
部分,否则 DO WHILE
循环将继续循环。这样可以很容易地永远运行并从一个 CPU 核心中耗尽所有时间。
做什么表达 :
结束。
表达式是布尔逻辑,比较,变量,字段等的任意组合,其计算结果为真值。
/* This is a well defined DO WHILE loop that will run as long as i is lower than 10*/
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DO WHILE i < 10:
i = i + 1.
END.
DISPLAY i. // Will display 10
你可以在 WHILE
-part 中使用任意数量的支票:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DO WHILE TODAY = DATE("2017-02-06") AND RANDOM(1,100) < 99:
i = i + 1.
END.
MESSAGE i "iterations done" VIEW-AS ALERT-BOX.
但是,编译器不会帮助你,所以检查最终是否满足 WHILE
-part:
/* Oops. Didnt increase i. This will run forever... */
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DO WHILE i < 10:
i = 1.
END.