=

Typeoperator
DictionaryLCS
LibraryLiveCode Script
Syntax
<value1> = value2
Synonymsis
Summary

Compares two values and evaluates to true if they are equal, false if they are not equal.

Introduced1.0
Changes

The ability to compare two arrays using = was added in version 3.5. Previously, comparing two arrays would have converted both arrays into the empty string, and always returned true.

OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
value1

The operands value1 and value2 can be numbers, literal strings of characters (delimited with double quotes), or any sources of value, including arrays.

Example
1 = 0 -- evaluates to false
17 + 9 = 26 -- evaluates to true
"ABC" = "abc" -- true if and only if caseSensitive is false
RelatedKeyword: character, numeric
Operator: <>, contains
Property: caseSensitive
Glossary: property, operator, case-sensitive, scientific notation, value, string, expression
Description

Use the = (equality) operator to find out whether two numeric expressions yield the same number or whether two strings are equivalent.

Note: A string in the form "xEy", where x is a number and y is an integer will be treated as a number in scientific notation. This means that such a string is evaluated as x * 10^y. For example:

put "3e2" = "300" -- returns true

When comparing strings, the = operator compares the two values character by character. If the caseSensitive property is true, the comparison between two strings treats uppercase letters as coming before lowercase letters. If the caseSensitive property is false, the comparison is not case-sensitive, so "a" = "A".

When comparing arrays, the = operator first checks if the number of elements in each array is the same, if not the two arrays are different. If the arrays have the same number of elements, they are equal if each element is equal. Specifically this means:

array1 = array2 if (and only if):

  • the number of elements of array1 = the number of elements of array2 and
  • for each element e in array1, array1[e] = array2[e].

Note: If an array is compared with a string, the array will first be converted into the empty string, thus any array is always equal to the empty string, and not equal to any other string.

Note: As of version 6.0 onwards expressions such as 'tArray is empty' will return true is and only if tArray contains the empty string. For example

put empty into tArray
answer tArray is empty -- true

put 100 into tArray["foo"]
answer tArray is empty -- false (prior to 6.0 this would be true)

Tagsmath