411 REFERENCE · Wikibooks
Futurebasic/Language/Reference/long if
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
LONG IF
Syntax
LONG IF expr [statementBlock1]
[XELSE[statementBlock2]]
END IF
Description
The 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.
If 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 END IF.
statementBlock1 and statementBlock2 may contain any number of executable statements, and may even include other "nested" if-blocks.
Notes
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.
See Also
IF; SELECT CASE
Language Reference