by Simon. Average Reading Time: less than a minute.
In addition to the comparison operators, which can be used on string values, the concatenation operator (&) concatenates two string values together, returning another string that is the union of the two operand strings. For example, “my ” & “string” returns the string “my string”.
The shorthand assignment operator &= can also be used to concatenate strings. For example, if the variable mystring has the value “alpha”, then the expression mystring &= “bet” evaluates to “alphabet” and assigns this value to mystring. This expression can be used in all CFML expressions.
comparison operators, which can be used on string values, the concatenation operator (&) concatenates two string values together, returning another string that is the union of the two operand strings. For example, “my ” & “string” returns the string “my string”.
An assignment operator assigns a value to its left operand based on the value of its right operand.
The basic assignment operator is equal (=), which assigns the value of its right operand to its left operand. That is, x = y assigns the value of y to x. The other assignment operators are usually shorthand for standard operations, as shown in the following table.
In the following series of posts, I will introduce the changes and show some simple examples. The first in the series is Arithmetic Operators.
Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/).
These operators work as they do in most other programming languages.
Logical operators are typically used with Boolean (logical) values; when they are, they return a Boolean value. However, the && and || operators actually return the value of one of the specified operands, so if these operators are used with non-Boolean values, they may return a non-Boolean value.