This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathequals.lcdoc
More file actions
90 lines (63 loc) · 2.73 KB
/
equals.lcdoc
File metadata and controls
90 lines (63 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Name: =
Synonyms: is
Type: operator
Syntax: <value1> = value2
Summary:
Compares two <value|values> and evaluates to true if they are equal,
false if they are not equal.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
1 = 0 -- evaluates to false
Example:
17 + 9 = 26 -- evaluates to true
Example:
"ABC" = "abc" -- true if and only if caseSensitive is false
Parameters:
value1:
The operands value1 and value2 can be numbers, literal strings of
characters (delimited with double quotes), or any sources of value,
including arrays.
Description:
Use the <=> (equality) <operator> to find out whether two <numeric>
<expression|expressions> yield the same number or whether two
<string|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
<value|values> <character> by <character>. If the <caseSensitive>
<property> is true, the comparison between two <string|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)
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.
References: property (glossary), operator (glossary),
case-sensitive (glossary), scientific notation (glossary),
value (glossary), string (glossary),
expression (glossary), character (keyword), numeric (keyword),
<> (operator), contains (operator), caseSensitive (property)
Tags: math