if

Syntax

if condition

Description

This command will allow your program to perform a sequences of commands based on the result of a condition. If the condition is true any commands that follow are performed. If the condition is false any following commands are skipped.

When an if statement is followed by the then keyword then only the next statement is affected.

An alternative approach to using an if statement is to ignore the then keyword. In this instance a number of lines of code can be executed. If you take this approach to finish the conditional check add endif.

Example

rem example 1
if a = 1 then print ( "a is 1" )

rem example 2 if a = 1 print ( "a is 1" ) endif