PI1X Basic Programming Manual Ver. 1.10
17/156
3.2
Commands for decision structures
IF … THEN … {ELSE IF…} [ELSE…] END IF
Purpose
:
To provide a decision structure for multiple-line conditional
execution.
Syntax
:
IF condition1 THEN [statements1] {ELSE IF condition2
THEN statements2} [ELSE elsestatements] END IF
Example
:
PRINT "Input a number:"
Result%=INPUT("",K%)
IF K% < 10 THEN
PRINT "One digit"
ELSE IF K% < 100 THEN
PRINT "Two digits"
ELSE
PRINT "Over one Hundry!"
END IF
Description
:
condition
is a logical expression.
statements
can be multiple lines of BASIC statements.