---
title: "any: WGSL and GLSL examples, uses and input limits"
description: "Any is true when at least one component of a boolean or a boolean vector is true. Use it for detecting whether a condition occurs anywhere."
url: https://typeshade.dev/reference/functions/any/
language: en
---

# `any`

Function

Any is true when at least one component of a boolean or a boolean vector is true.

## Compare examples

The result is true if any component is true. It is false only when every component is false.

**Example 1`any(vec2b(false, false))`**

`false` `false`

Components in this example

**Result**

`false`

**Example 2`any(vec2b(false, true))`**

`false` `true`

Components in this example

**Result**

`true`

**Example 3`any(vec2b(true, true))`**

`true` `true`

Components in this example

**Result**

`true`

The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.

## When to use it

Use it for detecting whether a condition occurs anywhere.

## Inputs and limits

A per-component comparison creates a boolean vector; any reduces it to a single boolean.

For shader input rules and precision, consult [WGSL](https://www.w3.org/TR/WGSL/) and [GLSL ES 3.00](https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf).

## Related functions

- [`all`](https://typeshade.dev/reference/functions/all/)
- [`select`](https://typeshade.dev/reference/functions/select/)

**WGSL**

`any(a)`

**GLSL ES 3.00**

`any(a)`

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

Whether any component of a vector of bools is true: `any(a < b)`.

## Syntax

```ts
declare function any(a0: bool): bool
declare function any<V extends vec2b | vec3b | vec4b>(a0: V): (bool)
declare function any(v: bool | BoolVec): bool
```

A signature may name a type the ambient file declares for its own use. These are those declarations.

**`BoolVec`**

`type BoolVec = vec2b | vec3b | vec4b`

## Parameters

- `v` `bool``V``bool | BoolVec`

## Return value

`bool``(bool)`

## Description

A scalar bool passes through. Over an array, write `xs.some((x) => ...)`.

## Targets

**WGSL**

`any(a)`

**GLSL ES 3.00**

`any(a)`

## Examples

- [`gallery/bool-select/bool-select.shade.ts`](https://typeshade.dev/guide/examples/bool-select/)
- [`gallery/packing-bitcast/packing-bitcast.shade.ts`](https://typeshade.dev/guide/examples/packing-bitcast/)

## See also

- [Functions](https://typeshade.dev/reference/functions/)
- [Builtin table](https://typeshade.dev/guide/language/builtins/#maths)
