User Guide
Writing Scripts with Lingo 409
Note: When only integers are used in an operation, the result is an integer. Using integers and floating-point
numbers in the same calculation results in a floating-point number.
When dividing one integer by another doesnβt result in a whole number, Lingo rounds the result
down to the nearest integer. For example, the result of
4/3 is 1.
To force Lingo to calculate a value without rounding the result, use
float() on one or more
values in an expression. For example, the result of
4/float(3) is 1.333.
Comparison operators
Comparison operators compare two values and determine whether the comparison is true or false.
These are the comparison operators available in Lingo:
Logical operators
Logical operators test whether two logical expressions are true or false. These are the logical
operators available in Lingo:
The
not operator is useful for toggling a TRUE or FALSE value to its opposite. For example,
the following statement turns on the sound if itβs currently off and turns off the sound if itβs
currently on:
set the soundEnabled = not (the soundEnabled)
+ Performs addition. 3
- When placed between two numbers, performs subtraction. 3
Operator Meaning Precedence
< Is less than 1
<= Is less than or equal to 1
<> Is not equal to 1
> Is greater than 1
>= Is greater than or equal to 1
=Equals 1
Operator Effect Precedence
and Determines whether both expressions are true. 4
or Determines whether either or both expressions are true. 4
not Negates an expression. 5
Operator Effect Precedence