Danaher Motion
06/2005
BASIC Moves Development Studio
M-SS-005-03 Rev
E
33
For example:
Dim Shared i as Long
Program
i = 0
Do
i = i + 1
Print i
Loop Until i = 10
End Program
or, equivalently, you can use
Loop While
:
Dim Shared i as Long
Program
i = 0
Do
i = i + 1
Print i
Loop While i < 10
End Program
GoTo
unconditionally redirects program execution. The syntax is:
GoTo
Label1
…
Label1
:
where:
Label1
is a valid label within the same task as the
GoTo
.
The label must be on a separate line.
You can only branch within a Program, Event, Function, or
Subroutine.
You can
GoTo
a label placed within a program block
(
If…Then
,
For…Next
,
Select…Case
,
While…End While
,
and
Do...Loop
) only if the
GoTo
and label are within the
same block.
If the program is within a program block, you cannot
GoTo
a
label outside that block.
Avoid
GoTo
wherever possible. History has shown that excessive use of
GoTo
makes programs harder to understand and debug. Use the other
program control statements whenever possible.
2.2.13.1. E
RROR
T
RAPPING
There are four ways to specify catch statements: Exact Value, Logical
Condition, Range, and Else. The syntax used is:
Catch
Error_Number
{
statements to execute if error Error_Number had occurred
}
Catch Is <
RelationalOperator
>
Error_Number
{
statements to execute if the condition is true
}
Catch
Error_Number1
To
Error_Number2
{
statements to execute if error number is between values
}
Catch Else
{
statements to execute if all other errors had occurred
}
where:
The number of
Catch
statements is not explicitly limited.
Error_Number
s can only be long-type numeric values.
In
Catch…To…
, if
Error_Number1
>
Error_Number2,
the
catch statement is never true and no error is flagged.