Section 9. Program Control Instructions
9-13
The
thenpart
and the
elsepart
fields both have this syntax:
{statements | [GoTo] linenumber | GoTo linelabel }
The
thenpart
and
elsepart
syntax has these parts:
Part Description
statements
One or more CRBasic statements, separated by colons.
Note
You can have multiple statements with a
condition
, but they
must be on the same line and separated by colons, as in the
following statement:
If
A > 10
Then
A = A + 1 : B = B + A : C = C + B
Syntax 2 Description
The block form of
If...Then...Else
provides more structure and flexibility than
the single-line form and is usually easier to read, maintain, and debug. Syntax
2 has these parts:
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
.
Содержание CR9000
Страница 6: ...CR9000 Table of Contents iv This is a blank page ...
Страница 22: ...CR9000 Overview OV 16 This is a blank page ...
Страница 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Страница 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Страница 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 217: ...This is a blank page ...