Skip to content

Commit 8aab381

Browse files
authored
Merge pull request #1497 from MitrahSoft/update_operators
Updated the operators page.md
2 parents 271c4e1 + 75a6ee5 commit 8aab381

File tree

1 file changed

+40
-40
lines changed
  • docs/04.guides/11.developing-with-lucee-server/03.operators

1 file changed

+40
-40
lines changed

docs/04.guides/11.developing-with-lucee-server/03.operators/page.md

+40-40
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ description: Mathematical, Logical, Ternary, Comparison, String and Elvis Operat
1515

1616
| Operator | Name | Description |
1717
| --------- | -------------- | ---------------------------------------------------------- |
18-
| **+** | Add | |
19-
| **-** | subtract | |
20-
| \* | multiply | |
21-
| / | divide | |
22-
| ^ | exponentiate | Raises one number to the power of another, e.g. 2 ^ 2 is 4 |
23-
| % | modulus | Returns the remainder of a number, e.g. 5 % 2 is 1 |
24-
| MOD | modulus | Returns the remainder of a number, e.g. 5 mod 2 is 1 |
25-
| \ | integer divide | Divides giving an integer result, e.g. 7 \ 2 is 3 |
26-
| ++ | increment | Increments a number. Can be used before or after an assignment, e.g. a = b++ would assign the value of b to a, then increment b. a = ++b would increment b, then assign the new value to a. In both cases, b would be incremented. **(not thread safe, see below)** |
27-
| **--** | decrement | Decrements a number. Can be used before or after an assignment, e.g. a = b-- would assign the value of b to a, then decrement b. a = --b would decrement b, then assign the new value to a. In both cases, b would be decremented. **(not thread safe, see below)** |
28-
| += | Compound add | A shorthand operator for adding to a value, e.g. a **+=** b is equivalent to writing a = a + b|
29-
| -= | Compound subtract | A shorthand operator for subtracting from a value, e.g. a **-=** b is equivalent to writing a = a *-* b |
30-
| ***=** | Compound multiply | A shorthand operator for multiplying a value, e.g. a ***=** b is equivalent to writing a = a * b |
31-
| **/=** | Compound divide | A shorthand operator for dividing a value, e.g. a /= b is equivalent to writing a = a / b |
18+
| **+** | Add | Add numbers, e.g. `2 + 2` is 4 |
19+
| **-** | subtract | Subtract numbers, e.g. `2 - 2` is 0 |
20+
| \* | multiply | Multiply numbers, e.g. `2 * 3` is 6 |
21+
| / | divide | Return the quotient of a number, e.g. `6 / 2` is 3 |
22+
| ^ | exponentiate | Raises one number to the power of another, e.g. `2 ^ 2` is 4|
23+
| % | modulus | Returns the remainder of a number, e.g. `5 % 2` is 1 |
24+
| MOD | modulus | Returns the remainder of a number, e.g. `5 mod 2` is 1 |
25+
| \ | integer divide | Divides giving an integer result, e.g. `7 \ 2` is 3 |
26+
| ++ | increment | Increments a number. Can be used before or after an assignment, e.g. `a = b++` would assign the value of b to a, then increment b. `a = ++b` would increment b, then assign the new value to a. In both cases, b would be incremented. **(not thread safe, see below)** |
27+
| **--** | decrement | Decrements a number. Can be used before or after an assignment, e.g. `a = b--` would assign the value of b to a, then decrement b. `a = --b` would decrement b, then assign the new value to a. In both cases, b would be decremented. **(not thread safe, see below)** |
28+
| += | Compound add | A shorthand operator for adding to a value, e.g. `a += b` is equivalent to writing `a = a + b`|
29+
| -= | Compound subtract | A shorthand operator for subtracting from a value, e.g. `a -= b` is equivalent to writing `a = a - b` |
30+
| ***=** | Compound multiply | A shorthand operator for multiplying a value, e.g. `a = b` is equivalent to writing `a = a * b` |
31+
| **/=** | Compound divide | A shorthand operator for dividing a value, e.g. `a /= b` is equivalent to writing `a = a / b` |
3232

3333
### Demonstration of unsafe threaded behavior with ++ and -- operators ###
3434

@@ -92,42 +92,42 @@ description: Mathematical, Logical, Ternary, Comparison, String and Elvis Operat
9292
| --------- | -------------- | ----------- |
9393
| ! | logical inversion | ! true is false |
9494
| NOT | logical inversion | not true is false |
95-
| AND | logical and | Returns true if both operands are true, e.g. 1 eq 1 and 2 eq 2 is true|
96-
| && | logical and | Returns true if both operands are true, e.g. 1 eq 1 && 2 eq 2 is true|
97-
| OR | logical or | Returns true if either or both operands are true, e.g. 1 eq 1 or 2 eq 3 is true|
98-
| **\|\|** | logical or | Returns true if either or both operand are true, e.g. 1 == 1 **\|\|** 2 == 3 is true |
99-
| XOR | logical exclusive or | Returns true if either operand is true, but not both, e.g. 1 == 1 XOR 2 == 3 is true, but 1 == 1 XOR 2 == 2 is false |
95+
| AND | logical and | Returns true if both operands are true, e.g. `1 eq 1 and 2 eq 2` is true|
96+
| && | logical and | Returns true if both operands are true, e.g. `1 eq 1 && 2 eq 2` is true|
97+
| OR | logical or | Returns true if either or both operands are true, e.g. `1 eq 1 or 2 eq 3` is true|
98+
| **\|\|** | logical or | Returns true if either or both operand are true, e.g. `1 == 1 \|\| 2 == 3` is true |
99+
| XOR | logical exclusive or | Returns true if either operand is true, but not both, e.g. `1 == 1 XOR 2 == 3` is true, but `1 == 1 XOR 2 == 2` is false |
100100

101101
## Comparison operators ##
102102

103103
| operators | Name | Description |
104104
| --------- | -------------- | ----------- |
105-
| EQ | equals | Returns true if operands are equal, e.g. "A" EQ "A" is true |
106-
| == | equals | Returns true if operands are equal, e.g. "A" == "A" is true |
107-
| === | identical | Returns true if operands are the same object in memory, false if they are not, (Note this is different than how JavaScript's === operator works. **Lucee 6 === works like javascript, comparing type and value** |
108-
| NEQ | does not equal | Returns true if operands are not equal, e.g. "A" NEQ "B" is true |
109-
| \<\> | does not equal | Returns true if operands are not equal, e.g. "A" <> "B" is true |
110-
| != | does not equal | Returns true if operands are not equal, e.g. "A" != "B" is true |
111-
| !== | is not identical | Returns true if operands are not equal or not of the same type, e.g. 1 !== "1" is true, but 1 !== 1 is false |
112-
| GT | greater than | Returns true if the operand on the left is has a higher value than the operand on the right, e.g. 1 GT 2 is false |
113-
| > | greater than |Returns true if the operand on the left is has a higher value than the operand on the right, e.g. 1 > 2 is false |
114-
| LT | less than | Returns true if the operand on the left has a lower value than the operand on the right, e.g. 1 LT 2 is true |
115-
| < | less than | Returns true if the operand on the left has a lower value than the operand on the right, e.g. 1 < 2 is true |
116-
| GTE | greater than or equal to | Returns true if the operand on the left has a value higher than or equal to the operand on the right, e.g. 2 GTE 2 is true |
117-
| >= | greater than or equal to | Returns true if the operand on the left has a value higher than or equal to the operand on the right, e.g. 2 >= 2 is true |
118-
| LTE | less than or equal to | Returns true if the operand on the left has a value lower than or equal to the operand on the right, e.g. 2 LTE 2 is true|
119-
| <= | less than or equal to | Returns true if the operand on the left has a value lower than or equal to the operand on the right, e.g. 2 <= 2 is true |
120-
| CONTAINS | contains | Returns true if the left operand contains the right operand, e.g. "SMILES" CONTAINS "MILE" is true |
121-
| CT | contains | Returns true if the left operand contains the right operand, e.g. "SMILES" CT "MILE" is true |
122-
| DOES NOT CONTAIN | does not contain | Returns true if the left operand does not contain the right operand, e.g. "SMILES" DOES NOT CONTAIN "RHUBARB" is true |
123-
| NCT | does not contain | Returns true if the left operand does not contain the right operand, e.g. "SMILES" NCT "RHUBARB" is true |
105+
| EQ | equals | Returns true if operands are equal, e.g. `"A" EQ "A"` is true |
106+
| == | equals | Returns true if operands are equal, e.g. `"A" == "A"` is true |
107+
| === | identical | Returns true if operands are the same object in memory, false if they are not, (Note this is different than how JavaScript's `===` operator works). **Lucee 6 === works like javascript, comparing type and value** |
108+
| NEQ | does not equal | Returns true if operands are not equal, e.g. `"A" NEQ "B"` is true |
109+
| \<\> | does not equal | Returns true if operands are not equal, e.g. `"A" <> "B"` is true |
110+
| != | does not equal | Returns true if operands are not equal, e.g. `"A" != "B"` is true |
111+
| !== | is not identical | Returns true if operands are not equal or not of the same type, e.g. `1 !== "1"` is true, but `1 !== 1` is false |
112+
| GT | greater than | Returns true if the operand on the left is has a higher value than the operand on the right, e.g. `1 GT 2` is false |
113+
| > | greater than |Returns true if the operand on the left is has a higher value than the operand on the right, e.g. `1 > 2` is false |
114+
| LT | less than | Returns true if the operand on the left has a lower value than the operand on the right, e.g. `1 LT 2` is true |
115+
| < | less than | Returns true if the operand on the left has a lower value than the operand on the right, e.g. `1 < 2` is true |
116+
| GTE | greater than or equal to | Returns true if the operand on the left has a value higher than or equal to the operand on the right, e.g. `2 GTE 2` is true |
117+
| >= | greater than or equal to | Returns true if the operand on the left has a value higher than or equal to the operand on the right, e.g. `2 >= 2` is true |
118+
| LTE | less than or equal to | Returns true if the operand on the left has a value lower than or equal to the operand on the right, e.g. `2 LTE 2` is true|
119+
| <= | less than or equal to | Returns true if the operand on the left has a value lower than or equal to the operand on the right, e.g. `2 <= 2` is true |
120+
| CONTAINS | contains | Returns true if the left operand contains the right operand, e.g. `"SMILES" CONTAINS "MILE"` is true |
121+
| CT | contains | Returns true if the left operand contains the right operand, e.g. `"SMILES" CT "MILE"` is true |
122+
| DOES NOT CONTAIN | does not contain | Returns true if the left operand does not contain the right operand, e.g. `"SMILES" DOES NOT CONTAIN "RHUBARB"` is true |
123+
| NCT | does not contain | Returns true if the left operand does not contain the right operand, e.g. `"SMILES" NCT "RHUBARB"` is true |
124124

125125
## String operators ##
126126

127127
| operators | Name | Description |
128128
| --------- | -------------- | ----------- |
129-
| & | concatenation | Joins two strings, e.g. The result of "Hello" & "World" is "HelloWorld" |
130-
| &= | compound concatenation | A shorthand operator that joins two strings, e.g. a &= b would be equivalent to writing `a = a & b` |
129+
| & | concatenation | Joins two strings, e.g. `The result of "Hello" & "World"` is "HelloWorld" |
130+
| &= | compound concatenation | A shorthand operator that joins two strings, e.g. `a &= b` would be equivalent to writing `a = a & b` |
131131

132132
## Ternary operator ##
133133

0 commit comments

Comments
 (0)