
<< Index >> 
FutureBasic 
if  statement  

x > 19.7
myName$ =
6*7 <= 42
In FutureBasic, numeric expressions and logical expressions are interchangeable. When a numeric expression is used in the context of a logical expression, then it's considered "true" if it's nonzero, or "false" if it's zero. For example:
Here, the x+3
is not zero.
When a logical expression is used in the context of a numeric expression, then it's evaluated as 1 if it's true, or as 0 if it's false. For example:
found = (fileName$ = seekName$)
Here, if fileName$
equals seekName$
, the value 1 is assigned to found
; otherwise, found
is assigned a value of 0.
You can use the operators
firstNumber
may evaluate to zero (false), even when both firstNumber
and secondNumber
are each nonzero (true). When you wish to use
firstNumber != 0
This expression behaves "logically," because (firstNumber != 0
) is always 1 or 0; and likewise (secondNumber != 0
) is always 1 or 0.
The
Note
Use caution when comparing floating point values to zero or to whole numbers. The following expression may not evaluate as expected:
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
and; or; not; select case