Schematic

MicroBasic Language Reference
Advanced Digital Motor Controller User Manual 203
While/Do Statements
While...End While Statement
While <condition>
<block>
End While
Example:
a = 10
While a > 0
Print(“a = “, a, “\n”)
a--
End While
Print(“Loop ended with a = “, a, “\n”)
Do While...Loop Statement
Do While <condition>
<block>
Loop
The Do While...Loop statement is the same as functionality of the While...
End While statement but uses a different syntax.
a = 10
Do While a > 0
Print(“a = “, a, “\n”)
a--
Loop
Print(“Loop ended with a = “, a, “\n”)
Do Until...Loop Statement
Do Until <condition>
<block>
Loop
Unlike Do While...Loop statement, Do Until...Loop statement exist the
loop when the expression evaluates to true.
a = 10
Do Until a = 0
Print(“a = “, a, “\n”)
a--
Loop
Print(“Loop ended with a = “, a, “\n”)
Do...Loop While Statement
Do
<block>
Loop While <condition>
Do...Loop While statement grantees that the loop block will be executed at
least once as the condition is evaluated and checked after executing the block.