a == b
The == operator compares two arguments and yields a boolean. If a is equal to b, then a==b yields true. If a is not equal to b, then a==b yields false. It is typically used in an if-statement.
a |
b |
a == b |
1 |
1 |
true |
1.01e2 |
101.0 |
true |
31 |
1 |
false |
true |
false |
false |
The normal equal sign (=) should only be used for equations. The equal sign (=) makes the left side of an equation equal to the right side. This is different to the equal statement (==) which compares two arguments and yields a boolean.