# 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](/reference/cql/expressions/operations/comparison/overview#equivalence) as the [equal operation](/reference/cql/expressions/operations/comparison/equal), making them almost interchangeable, except for the [order of evaluation](/reference/cql/expressions/basics#evaluation-order). However, specifying a comparison mode makes the test behave differently.

## Syntax

This test has the following syntax:

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

When comparing a value to a [literal](/reference/cql/expressions/literals), you can use the following shorthand syntax:

```cql
/*<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.

> **Syntax error**
>
> Always use the full syntax when comparing a value to a non-literal, such as a variable or expression. Using the shorthand form will result in a syntax error.

For inequality, you can use the following syntax:

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

You can optionally specify a comparison mode:

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

The following table describes the supported modes:

| Mode                  | Description                                                                                                                |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `ignoring case`       | Compare strings ignoring case. For example, `"foo"` is equal to `"FOO"` in this mode.                                      |
| `ignoring time`       | Compare date-time values ignoring time. For example, `2026-08-07T00:00:00` is equal to `2026-08-07T23:59:59` in this mode. |
| `ignoring fraction`   | Compare numbers ignoring the decimal part. For example, `1.5` is equal to `1.9` in this mode.                              |
| `considering numbers` | Compare 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](/reference/cql/expressions/operations/comparison/equal).

## Parameters

These are the supported parameters:

- `value`: `comparable`

  The value to check for equality.

- `reference`: `comparable`

  The other value to compare against.

## Examples

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

```cql
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:

```cql
1 + 2 is 3 // true
```

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

```cql
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:

```cql
"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:

```cql
"2026-08-07" is equal to "2026-08-07T23:59:59" ignoring time // true
```
