User Guide
Chapter 16410
String operators
String operators combine and define strings. These are the string operators available in Lingo:
Controlling flow in scripts
Lingo uses if...then...else, case, and repeat statements to perform an action depending on
whether a condition exists. See the following sections.
Using if statements
Statements that check whether a condition is true or false begin with the Lingo term
if. If the
condition exists, Lingo executes the statement that follows
then. If the condition doesn’t exist,
Lingo skips to the next statement in the handler.
To optimize your script’s performance, test for the most likely conditions first.
The following statements test several conditions. The term
else if specifies alternative tests to
perform if previous conditions are false:
if the mouseMember = memberNum("map 1") then
go to "Cairo"
else if the mouseMember = member ("map 2") then
go to "Nairobi"
else
alert "You’re lost."
end if
When writing if…then structures, you can place the statement following then in the same line as
then, or you can place it on its own line by inserting a carriage return after then. If you insert a
carriage return, you must also include an
end if statement at the end of the if…then structure.
For example, the following statements are equivalent:
if the mouseMember = member("map 1") then go to "Cairo"
if the mouseMember = member("map 1") then
go to "Cairo"
end if
For more information, see if in the Lingo Dictionary.
Using case statements
The
case statement is a shorthand alternative to repeating if…then statements when setting up a
multiple branching structure. A
case statement is often more efficient and easier to read than a
large number of
if...then...else statements.
The condition to test for follows the term
case in the first line of the case structure. The
comparison goes through each line in order until Lingo encounters an expression that matches
the test condition. When a matching expression is found, Director executes the Lingo that follows
the matching expression.
Operator Effect Precedence
& Concatenates two strings. 2
&& Concatenates two strings and inserts a space between the
two.
2
" Marks the beginning or end of a string. 1