Equal test

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

This test checks whether two values are equal, with the option to specify a comparison mode.

By default, this test uses the same equivalence rules as the equal operation, making them almost interchangeable, except for the order of evaluation. However, specifying a comparison mode makes the test behave differently.

Syntax

This test has the following syntax:

/*<value>*/ is equal to /*<reference>*/

When comparing a value to a literal, you can use the following shorthand syntax:

/*<value>*/ is /*<literal>*/

Both forms have the same semantics, but the shorthand syntax only works with literals and does not support specifying the comparison mode.

For inequality, you can use the following syntax:

/*<value>*/ is not equal to /*<reference>*/

You can optionally specify a comparison mode:

/*<value>*/ is equal to /*<reference>*/ /*<mode>*/

The following table describes the supported modes:

ModeDescription
ignoring caseCompare strings ignoring case. For example, "foo" is equal to "FOO" in this mode.
ignoring timeCompare date-time values ignoring time. For example, 2025-09-19T00:00:00 is equal to 2025-09-19T23:59:59 in this mode.
ignoring fractionCompare numbers ignoring the decimal part. For example, 1.5 is equal to 1.9 in this mode.
considering numbersCompare values numerically, even if they are strings. For example, 1 is equal to "1.0" in this mode.

By default, the comparison behaves exactly like the equal operation.

Parameters

These are the supported parameters:

value

The value to check for equality.

reference

The other value to compare against.

Examples

Here is a basic example of how to check whether a value is equal to another value:

1 + 2 is equal to 3 // true

You can also use the shorthand syntax for literals. The following example is equivalent to the previous one:

1 + 2 is 3 // true

The shorthand syntax works only with literals, so the following example is invalid:

1 + 2 is result // 🚨 Invalid

You can specify a comparison mode to change the comparison behavior. For example, the following condition checks whether a string is equal to another, ignoring case:

"foo" is equal to "FOO" ignoring case // true

In the same way, you can check whether a date-time value is equal to another, ignoring time:

"2025-09-19" is equal to "2025-09-19T23:59:59" ignoring time // true
Try in Playground