# between

> **between**\<`N`, `L`, `H`\>(`name`, `low`, `high`): [`BetweenNode`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/query/interfaces/betweennode/)\<`ValueRef`\<`N`, `L`\>\>

Defined in: [src/query/expression.ts:375](https://github.com/Arkiv-Network/arkiv-sdk-js/blob/d464c8dce16c3b8c472479ac5aae9d14344eb067/src/query/expression.ts#L375)

Attribute lies between two values, **inclusive** at both ends: it matches exactly what
`and(gte(name, low), lte(name, high))` matches, in one predicate. Both bounds must have one type,
and a `low` above `high` matches nothing.

## Type Parameters

### N

`N` *extends* `string`

### L

`L` *extends* [`PredicateValue`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/query/type-aliases/predicatevalue/)

### H

`H` *extends* [`PredicateValue`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/query/type-aliases/predicatevalue/)

## Parameters

### name

`N`

### low

`L`

### high

`H` & `SameTypeCheck`\<`L`, `H`\>

## Returns

[`BetweenNode`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/query/interfaces/betweennode/)\<`ValueRef`\<`N`, `L`\>\>

## Throws

If the name is outside the attribute name grammar.

## Throws

If the bounds have different types, the name starts with `$` but
is not a queryable system attribute, a system attribute is compared against the wrong type, or a
bound is `bytes`.

## Example

```ts
between("score", dec("3.5"), dec("5"))  // score BETWEEN dec(3.5) AND dec(5)
between("$expiresAt", u64(100n), u64(200n))
```