Section 9. Program Control Instructions
9-10
Part
Description
If
Keyword that begins the block If...Then decision control
structure.
condition1
Same as condition used in the single-line form shown above.
Then
Keyword used to identify the actions to be taken if a
condition is satisfied.
statementblock-1 One or more CRBasic statements executed if condition1 is
true.
ElseIf
Keyword indicating that alternative conditions must be
evaluated if condition1 is not satisfied.
condition2
Same as condition used in the single-line form shown above.
statementblock-2 One or more CRBasic statements executed if condition2 is
true.
Else
Keyword used to identify the actions taken if none of the
previous conditions are satisfied.
statementblock-n One or more CRBasic statements executed if condition1 and
condition2 are both false.
End If
Keyword that ends the block form of the If...Then.
In executing a block If, CRBasic tests condition1, the first numeric expression.
If the expression is true, the statements following Then are executed.
If the first expression is false, CRBasic begins evaluating each ElseIf condition
in turn. When CRBasic finds a true condition, the statements immediately
following the associated Then are executed. If none of the ElseIf conditions is
true, the statements following the Else are executed. After executing the
statements following Then or Else, the program continues with the statement
following End If.
The Else and ElseIf clauses are both optional. You can have as many ElseIf
clauses as you like in a block If, but none can appear after an Else clause. Any
of the statement blocks can contain nested block If statements.
CRBasic looks at what appears after the Then keyword to determine whether
or not an If statement is a block If. If anything other than a comment appears
after Then, the statement is treated as a single-line If statement.
A block If statement must be the first statement on a line. The Else, ElseIf,
and End If parts of the statement can have nothing but spaces in front of them.
The block If must end with an End If statement.
For Example
If a > 1 And a <= 100 Then
...
ElseIf a = 200 Then
...
End If
Tip
Select Case may be more useful when evaluating a single expression
that has several possible actions.
Содержание CR5000
Страница 39: ...Section 1 Installation and Maintenance 1 15 S A N Y O FIGURE 1 11 6 Removal of band clamp and battery ...
Страница 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Страница 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Страница 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Страница 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Страница 206: ......
Страница 236: ...Index Index 4 This is a blank page ...
Страница 237: ...This is a blank page ...