Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 
Table of contents Previous: McBASI Interpreter Commands and Reserved Words GOTO Next: McBASI Interpreter Commands and Reserved Words INPUT Index

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 and Reserved Words GOTO Next: McBASI Interpreter Commands and Reserved Words INPUT Index
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690