Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

While...Wend

与えられた条件が True であれば、一連の文を実行します。

Synopsis

While condition
    [statements]
Wend

引数

While...Wend 文の構文は、以下の部分で構成されています。

conditions True または False で評価される式。
statements 条件が True の間に実行する、単独または複数の文。

概要

条件が True の場合、Wend 文が見つかるまで文内のすべての文が実行されます。制御が While 文に戻り、条件が再度チェックされます。条件がTrue のままであれば、プロセスが繰り返されます。True でなければ、Wend 文の後の文から実行が再開されます。

While...Wend ループはいずれのレベルでも入れ子にすることができます。各 Wend は最後に実行された While と対応します。

以下の例は、While...Wend 文の使用法を示しています。

Dim Counter
Counter = 0                ' Initialize variable.
While Counter < 20         ' Test value of Counter.
   Counter = Counter + 1   ' Increment Counter.
   Print Counter
Wend                       ' End While loop when Counter > 19.

メモ

Do...Loop 文は、ループを実行するために、さらに構造化された柔軟な方法を提供します。

関連項目

FeedbackOpens in a new tab