> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

> Reference material for ARRAY_ANY_MATCH function

# ARRAY_ANY_MATCH

* Returns `TRUE` if any element in the array is `TRUE`.
* Returns `FALSE` if all elements in the array are `FALSE` or if the array is empty.
* Returns `NULL` if any element is `NULL` and no element is `TRUE`.

When an optional lambda function is provided, `ARRAY_ANY_MATCH` applies the function to each element and then evaluates the resulting array.

**Alias:** `ANY_MATCH`

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
{ ANY_MATCH | ARRAY_ANY_MATCH }([<expression> -> <condition>], <array> [, <array2>, ...])
```

## Parameters

| Parameter      | Description                                                                                                                                                                                                                                                                                                                    | Supported input types                                                              |
| :------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- |
| `<expression>` | A lambda function applied to each element of the input arrays, returning a `BOOLEAN`. If no lambda function is provided, the function can only evaluate a single `BOOLEAN` array. For more information, see [Manipulating arrays with Lambda functions](/guides/sql-dialect/arrays#manipulating-arrays-with-lambda-functions). | Same as the element data types of the input arrays.                                |
| `<condition>`  | A `BOOLEAN` expression that evaluates each array value using a comparison operator.                                                                                                                                                                                                                                            | See [Comparison operators](/reference-sql/lexical-structure/operators#comparison). |
| `<array>`      | The array to evaluate.                                                                                                                                                                                                                                                                                                         | `ARRAY`                                                                            |

## Return Types

The `ARRAY_ANY_MATCH` function returns a result of type `BOOLEAN`.

## Examples

**Example**

The following code example checks if an array contains the value `esimpson` as the result `is_he_playing`. Returns `FALSE` because the array does not contain the specified value.

<div className="query-window">
  ```
  SELECT ARRAY_ANY_MATCH(x -> x = 'esimpson', [ 'kennethpark', 'sabrina21', 'steven70']) AS is_he_playing;
  ```

  | is\_he\_playing <span>boolean</span> |
  | :----------------------------------- |
  | False                                |

  <p><span>Rows: 1</span><span>Execution time: 5.59ms</span></p>
</div>

**Example**

The following code example checks if each element in the first array is divisible by the corresponding element in the second array in a result labeled `divisible`. Returns `TRUE` because at least one element in the first array is divisible by its corresponding element in the second array (45 / 15).

<div className="query-window">
  ```
  SELECT ARRAY_ANY_MATCH(x, y -> (x % y) = 0, [ 10, 20, 30, 45 ], [ 12, 3, 42, 15]) AS divisible;
  ```

  | divisible <span>boolean</span> |
  | :----------------------------- |
  | True                           |

  <p><span>Rows: 1</span><span>Execution time: 5.95ms</span></p>
</div>

**Example**

The following code example evaluates multiple arrays using `ARRAY_ANY_MATCH`. Returns `FALSE` for the empty array, `TRUE` for the `[TRUE]` array, `FALSE` for the `[FALSE]` array, `NULL` for the `[NULL]` array, and `NULL` for the `[FALSE, NULL]` array.

<div className="query-window">
  ```
  SELECT ARRAY_ANY_MATCH([]) AS empty, ARRAY_ANY_MATCH([true]) AS single_true, ARRAY_ANY_MATCH([false]) AS single_false, ARRAY_ANY_MATCH([NULL]) AS single_null, ARRAY_ANY_MATCH([false, NULL]) AS false_and_null;
  ```

  | empty <span>boolean</span> | single\_true <span>boolean</span> | single\_false <span>boolean</span> | single\_null <span>boolean null</span> | false\_and\_null <span>boolean null</span> |
  | :------------------------- | :-------------------------------- | :--------------------------------- | :------------------------------------- | :----------------------------------------- |
  | False                      | True                              | False                              | NULL                                   | NULL                                       |

  <p><span>Rows: 1</span><span>Execution time: 5.87ms</span></p>
</div>
