This section describes how 'Do ... Loop' statements work in VBScript. A block of statements is repeated based on the specified condition.
Personally, I think that two types of loops, "For ... Next" and "While", are enough for any loop programming situations.
But the designers of VBScript decided to give us an extra type of loops, "Do ... Loop" statements, with the following
different flavors:
1. "Do While ... Loop" Statements
Do While condition
statement_block
Loop
They are identical logically to:
While condition
statement_block
Wend
2. "Do Until ... Loop" Statements
Do Until condition
statement_block
Loop
They are identical logically to:
While Not condition
statement_block
Wend
3. "Do ... Loop While" Statements
Do
statement_block
Loop While condition
They are identical logically to:
statement_block
While condition
same_statement_block
Wend
4. "Do ... Loop Until" Statements
Do
statement_block
Loop Until condition
They are identical logically to:
statement_block
While Not condition
same_statement_block
Wend
I will leave it to you to write some sample scripts for "Do ... Loop" statements as exercises.
Note that VBScript offers "Exit Do" statements to allow you to terminate "Do ... Loop" statements early.