Execute-the-Operation-First-When-Post-Condition-Is-True,-Continue-the-Loop
Command Description
The Block is executed first. In "While loop", the Block continues when the conditional expression is true and exits the loop when expression is false
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