Table of contents Previous: McBASI Interpreter Commands GOTO Next: McBASI Interpreter Commands INPUT

IF

Compares expressions, using relational operators, to determine whether to execute a statement.


Syntax

IF expr relop expr statement


Parameters

expr

any valid expression

relop

any relational operator

 

=

means equal

 

< > or > <

means not equal

 

>

means greater than

 

<

means less than

 

>= or =>

means greater than or equal to

 

<= or =<

means less than or equal to

statement

step to be executed if the relationship is true


Remarks

If several statements are used, either all are done (if the relationship is true) or none are done (if it is false). To compare character strings, use only the = and < > relational operators. If statement is a let statement (a replacement statement) use the command LET.


Example

IF X=8 LET Y=13:LET J=9:GOTO 890

If X=8 is true, both LET statements and the GOTO statement are executed.


Table of contents Previous: McBASI Interpreter Commands GOTO Next: McBASI Interpreter Commands INPUT