Navigation:  Reference > Commands >

If

Print this Topic Previous pageReturn to chapter overviewNext page

 

This is a process control command, i.e., it will control whether a command, or group of commands, will be executed.  This is one part of a complete command structure.

 

IF lexpr Required - If the if_expression resolves to .TRUE., the what_to_do action will be taken.  If it is .FALSE. and the what_to_do action is not THEN, the program will look for the next ELSE_IF or ELSE command.  If one is not found the program will transfer control to the line following the appropriate ENDIF command.

 

what_to_do - sac The action to take if the expression resolves to .TRUE.  Possible actions include:

 

       DO -  Do the following commands until the program reaches an ELSE, ELSE_IF or ENDIF command.  This is the default value and doesn't have to be specified.

 

       THEN -  Execute the following command.  The command to execute in this case may follow on the same physical line or it will execute the command on the following line.

 

       GOTO -  Goto the line label specified in the goto_gosub_label.

 

       GOSUB - Gosub the line label specified in the goto_gosub_label.

 

       RET - Execute the RET (Return) command.

 

       NOTE:  DO NOT use this option to return a value.  The RET here is just a return.  If you want to return a value you would use:

 

                               IF lexpr THEN RET value

 

 

goto_gosub_labelIf the what_to_do option is GOTO or GOSUB then you must specify the label name here.

 

COMMENTS

For more information on the different structured programming commands, and the IF command in particular, please see Structured Programming Commands.

 

SEE ALSO

ELSE, ELSE_IF, ENDIF

 

 


Page url: http://www.cassoftware.com/tas/manual/if.htm