Promotic

Do...Loop - statement of language VBScript

Description:
Repeats a block of statements while the condition is true or until a condition becomes true..
Syntax:
Do [{While|Until} condition]
  [statements]
[Exit Do]
  [statements]
Loop


also the following syntax can be used, where the condition is at the end:
Do
  [statements]
[Exit Do]
  [statements]
Loop [{While|Until} condition]


condition Number or text string that is true or false. If condition is Null, then condition is treated as false.
statements One or more statements that are repeated while or until condition is true.
Note:
The Exit Do can only be used within a Do...Loop control structure to provide an alternate way to exit a Do...Loop. Any number of Exit Do statements may be placed anywhere in the Do...Loop. Often used with the evaluation of some condition (for example If...Then). Exit Do transfers control to the statement immediately following the Loop.
When used within nested Do...Loop statements, then Exit Do transfers control to the loop that is nested one level above the loop where it occurs.

For similar purpose in the JavaScript language is used the statement while and do...while.
See also:
Example:
VBScriptSelect and copy to clipboard

Dim DefResp, MyNum
Do
MyNum = Int(6 * Rnd() + 1)   ' Generate a random integer between 1 and 6
DefResp = MsgBox(MyNum & " " & "Do you want another number?", vbYesNo)
Loop While DefResp = vbYes
VBScriptSelect and copy to clipboard

Dim Counter
Counter = 0
Do While Counter <= 20
Counter = Counter + 1
If Counter = 10 Then
Exit Do
End If
Loop
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.