IF / THEN / ELSE / ELSEIF / END IF
<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > Program Flow > IF / THEN / ELSE / ELSEIF / END IF |
Description
Create IF/THEN/ELSE constructs with multiple lines and/or conditions.
Syntax 1
IF logical_expression THEN
{statements}
[ELSEIF logical_expression THEN
{statements}]
[ELSE
{statements}]
END IF
Syntax 2
IF logical_expression THEN {statements}
Returns
Parameters
Remarks
Restrictions
See also
Examples
RANDOMIZE
DIM X AS NUMBER VALUE ( RND * 500 ) + 1
DIM Msg AS STRING
IF X <= 10 THEN
Msg = X & ": The number <= 10"
ELSEIF X <= 20 THEN
Msg = X & ": The number > 10 and <= 20"
ELSE
IF X < 50 THEN
Msg = X & ": The number is > 20 and less than 50"
ELSEIF X < 100 THEN
Msg = X & ": Greater than 49 and less than 100"
ELSE
Msg = X & ": The number is 100 or greater"
END IF
END IF
IF Msg <> "" THEN
MSGBOX 0, Msg
END IF