做什麼

除非滿足 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.