`prev Menu next`

IF statement( IF line) ☆☆
`IF logical_expression THEN imperative_statement
IF logical_expression THEN imperative_statement1 ELSE imperative_statement2
`
Example.
`IF D>0 THEN PRINT (-b+sqr(D))/(2*a),(-b-sqr(D))/(2*a)
IF A=1 THEN PRINT "Y" ELSE PRINT "N"
`
Only one imperative statement can be written succeeding THEN and only one imperative statement can be written succeeding ELSE (if any).
An imperative statement is a statement that is neither declarative nor part of a block.
Many statements such as LET, PRINT, INPUT, SET, PLOT, GOTO, EXIT, CALL, STOP are imperative, but a IF statement is not imperative.
Thus, no IF statement can be written succeeding THEN.
Therefore, Full BASIC never generate an obscure statement like
`IF a=0 THEN IF b=1 THEN … ELSE …`
Note.
An IF-line that has no statement succeeding THEN is regarded as part of an IF～END IF block, and consequently a corresponding END-IF-line is needed.