Chapter 14. Statement Reference
226
Syntax:
Syntax 1:
IF conditionalexpression THEN
statementblock1
[ELSE
statementblock2]
END IF
Syntax 2:
IF conditionalexpression ELSE
statementblock
END IF
Parameter:
conditionalexpression
A numeric expression which evaluates to true or false.
Description:
IF
statement block tests whether
conditionalexpression
is true or false. If
the condition is true (not zero),
statementblock
which follows
THEN
is exe-
cuted; if it is false (zero),
statementblock
which follows
ELSE
is executed.
Then, program control passes to the first statement after
END
IF
.
• You can omit either
THEN
block or
ELSE
block.
•
IF
statement block should terminate with
END
IF
which indicates the end of the
block.
•
IF
statement blocks can be nested. When using the
IF
statement block together
with other block-structured statements (
DEF
FN
...
END
DEF
,
FOR
...
NEXT
,
FUNC-
TION
...
END
FUNCTION
,
IF
...
THEN
...
ELSE
...
END
IF
,
SELECT
...
CASE
…
END
SELECT
,
SUB
...
END
SUB
, and
WHILE
...
WEND
), you can nest them to a maxi-
mum of 30 levels.
Flow control statement
IF...THEN...ELSE...END IF
Conditionally executes specified statement blocks depending upon the evaluation of a condi-
tional expression.
Summary of Contents for BHT-BASIC 100 SERIES
Page 1: ......
Page 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Page 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Page 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Page 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...