Vbscript-loops

提供:Dev Guides
移動先:案内検索

VBScript-ループ

コードのブロックを数回実行する必要がある場合があります。 一般に、ステートメントは順番に実行されます。関数の最初のステートメントが最初に実行され、次に2番目のステートメントが実行されます。

プログラミング言語は、より複雑な実行パスを可能にするさまざまな制御構造を提供します。 ループステートメントを使用すると、ステートメントまたはステートメントのグループを複数回実行できます。VBScriptのループステートメントの一般的なものは次のとおりです。

ループアーキテクチャ

VBScriptは、ループ要件を処理するために次の種類のループを提供します。 詳細を確認するには、次のリンクをクリックしてください。

Loop Type Description
for loop Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
for ..each loop It is executed if there is at least one element in group and reiterated for each element in a group.
while..wend loop It tests the condition before executing the loop body.
do..while loops The do..While statements will be executed as long as condition is True.(i.e.,) The Loop should be repeated till the condition is False.
do..until loops The do..Until statements will be executed as long as condition is False.(i.e.,) The Loop should be repeated till the condition is True.

ループ制御ステートメント

ループ制御ステートメントは、通常のシーケンスから実行を変更します。 実行がスコープを離れると、ループ内の残りのステートメントはすべて実行されません。

VBScriptは、次の制御ステートメントをサポートしています。 詳細を確認するには、次のリンクをクリックしてください。

Control Statement Description
Exit For statement Terminates the *For loop *statement and transfers execution to the statement immediately following the loop
Exit Do statement Terminates the* Do While* statement and transfers execution to the statement immediately following the loop