O'Reilly logo

Lingo in a Nutshell by Bruce A. Epstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Operators

Lingo can perform calculations and evaluate expressions using a variety of operators. Arithmetic operators are explained in Chapter 8. Operators with a higher precedence are performed first. Use parentheses to override the default evaluation order. See "Precedence Caveats" below.

Comparison Operators

Lingo supports the usual complement of comparison operators, as shown in Table 5-7. Use these in conditional expressions, such as repeat while... and if...then, to compare various data types or whether a Boolean property is TRUE or FALSE.

Tip

The <, <=, >, and >= operators perform case-sensitive string comparisons whereas the =, <>, contains, and starts operators are case-insensitive. See Appendix C.

Table 5-7. Comparison Operators

Operator

Comparison

Precedence

[a]
[b]

<

less than

1

<=

less than or equal to[a]

1

<>

not equal to[a]

1

=

equal to[b]

1

>

greater than

1

>=

greater than or equal to[a]

1

contains

string1 contains string2

N/A

starts

string1 starts string2

N/A

intersects

sprite1 intersects sprite2

N/A

within

sprite1 within sprite2

N/A

[a] 1Note that “><,” “=<,” and “=>” are not acceptable alternatives to “<>,” “>=,” and “<=.”

[b] 2When used within an if or repeat while.., statement the equals sign (“=”) compares whether two values are equal. It does not assign a value, as it does when used with the set command.

Comparison Caveats

Implicit Type Conversion

Lingo allows comparison between different data types, but it will convert one operand ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required