Data Sheet

MicroBasic Language Reference
Advanced Digital Motor Controller User Manual 205
The following is an example of how to use Continue statement in While loop:
While a > 0
If b = 0 Then Continue While
End While
GoTo Statement
A GoTo statement causes execution to transfer to the specified label. GoTo keyword
should be followed by the label name.
GoTo <label>
The following example illustrates how to use GoTo statement:
GoTo Target_Label
Print(“This will not be printed.\n”)
Target_Label:
Print(“This will be printed.\n”)
GoSub/Return Statements
GoSub used to call a subroutine at specific label. Program execution is transferred to the
specified label. Unlike the GoTo statement, GoSub remembers the calling point. Upon
encountering a Return statement the execution will continue the next statement after the
GoSub statement.
GoSub <label>
Return
Consider the following example:
Print(“The rst line.”)
GoSub PrintLine
Print(“The second line.”)
GoSub PrintLine
Terminate
PrintLine:
Print(“\n”)
Return
The program will begin with executing the first print statement. Upon encountering the
GoSub statement, the execution will be transferred to the given PrintLine label. The pro-
gram prints the new line and upon encountering the Return statement the execution will
be returning back to the second print statement and so on.