Equal operation

Learn how to check if a value is equal to another.

The equal operation checks whether two values are equal. Unlike relational operations, it works on any value, not just values that have a concept of order.

To check whether two values are equal, place the == operator between them:

/*<operand>*/ == /*<operand>*/
Try in Playground

Here's a practical example involving strings:

"hello" == "hello" // true
Try in Playground

And another one involving numbers:

1 == 1.0 // true
Try in Playground

Although there is no natural language equivalent to the == operator, you can use the equal to test for a more natural reading:

/*<operand>*/ is equal to /*<operand>*/
Try in Playground

Note that operations and tests may differ in their behavior and precedence. Please refer to the documentation of each specific operation and test for more information.