[long ]if expr
long if statement marks the beginning of an "if-block," which must be terminated with the
end if statement. The
expr can be either a logical expression (such as:
personCount>17), a numeric expression, or a string. A numeric expression is counted as "true" if it evaluates to a nonzero value. A string is counted as "true" if its length is greater than zero.
expr is "true," then only the statements in
statementBlock1 are executed, and execution then continues at the first statement after
end if. if
expr is "false," then only the statements in
statementBlock2 (if any) are executed, and execution then continues at the first statement after
statementBlock2 may contain any number of executable statements, and may even include other "nested" if-blocks.
To conditionally execute just a single statement, consider using the
if statement instead. To conditionally execute statement blocks based on more complex conditions, use the
select case statement.
Use caution when comparing floating point values to zero or to whole numbers. The following expression may not evaluate as expected:
long if x# = 1
In this statement, the compiler compares the value in x# to an integer "1". Since SANE and PPC math both use fractional approximations of numbers, the actual value of x#, though very close to one, may actually be something like 0.99999999 and therefore render unexpected results.
if; and; or; not; select case