Do Loop While
Command Description
Execute the following statement block, and after each execution, check whether the condition holds. If it holds, execute it again; if it does not hold, stop executing.
Command Prototype
Do
Loop While expression
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
expression | True | expression | 1 > 0 | The expression used for judgment |
Demo
TracePrint("------------------------------------------------ Continue the loop when the postcondition is true------ ------------------------------------")
//-------------------------------------------------------------------------------
//[Remarks] When using While , execute the Block statement block, and exit the loop when expression is true.
TracePrint("Let a=1, let a increment by 1, at this time a = 2, meet the loop condition a=2, exit the loop")
a = 1
Do
a = a + 1
TracePrint a
Loop While a = 2