&&, + (concatenation operator)
599
Avoid this problem by placing parentheses around the entire phrase that includes an operator.
The parentheses clear up Lingo’s confusion by changing the precedence by which Lingo deals
with the operator, causing Lingo to treat the two parts of the argument as one complete
argument.
Example
This statement concatenates the strings “abra” and “cadabra” and displays the resulting string in
the Message window:
-- Lingo syntax
put("abra" & "cadabra")
// JavaScript syntax
put("abra" + "cadabra");
The result is the string “abracadabra”.
This statement concatenates the strings “$” and the content of the
price
variable and then
assigns the concatenated string to the Price field cast member:
-- Lingo syntax
member("Price").text = "$" & price
// JavaScript syntax
member("Price").text = "$" + price;
&&, + (concatenation operator)
Usage
-- Lingo syntax
expression1
&&
expression2
// JavaScript syntax
expression1
+
expression2
Description
String operator; concatenates two expressions, inserting a space character between the original
string expressions. If either
expression1
or
expression2
is a number, it is first converted to a
string. The resulting expression is a string.
This is a string operator with a precedence level of 2.
Example
This statement concatenates the strings “abra” and “cadabra” and inserts a space between the two:
-- Lingo syntax
put("abra" && "cadabra")
// JavaScript syntax
put("abra " + "cadabra");
The result is the string “abra cadabra”.
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...