Lingo Dictionary > Symbols > & (concatenator) |
![]() ![]() ![]() |
& (concatenator)
Syntax
expression1
&
expression2
Description
String operator; performs a string concatenation of two 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.
Be aware that Lingo allows you to use some commands and functions that take only one argument without parentheses surrounding the argument. When an argument phrase includes an operator, Lingo interprets only the first argument as part of the function, which may confuse Lingo.
For example, the open window
command allows one argument that specifies which window to open. If you use the &
operator to define a pathname and file name, Director interprets only the string before the &
operator as the file name. For example, Lingo interprets the statement open window the applicationPath & "theMovie"
as (open window the applicationPath) & ("theMovie")
. Avoid this problem by placing parentheses around the entire phrase that includes an operator, as follows:
open window (the applicationPath & "theMovie")
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:
put "abra" & "cadabra"
The result is the string "abracadabra".
Example
This statement concatenates the strings "$" and the content of the price
variable and then assigns the concatenated string to the Price field cast member:
member("Price").text = "$" & price
![]() ![]() ![]() |