# listOf

Source: https://taxilang.org/docs/language/stdlib/listOf

**Full name:** `taxi.stdlib.listOf`

## Signature

```taxi
declare function <T> listOf(values:T...):T[]
```

## Description

Creates and returns an array containing all the provided values.

This function is useful for creating collections inline without having to define them separately.

```taxi
// Create a list of allowed status values
find { order: Order } as {
   isValidStatus: listOf('PENDING', 'PROCESSING', 'SHIPPED', 'DELIVERED').contains(order.status)
}
```

## Examples

Creates an inline collection to check if an order status is one of the valid values.

Schema:

```taxi
model Order {
   id: String
   status: String
}
```

Query:

```taxi
given {
   orders: Order[] = [
      { id: 'order-1', status: 'PENDING' },
      { id: 'order-2', status: 'SHIPPED' },
      { id: 'order-3', status: 'CANCELED' }
   ]
}
find {
   validOrders: Order[] = orders.filter((order:Order) ->
      listOf('PENDING', 'PROCESSING', 'SHIPPED', 'DELIVERED').contains(order.status)
   )
   invalidOrders: Order[] = orders.filter((order:Order) ->
      listOf('PENDING', 'PROCESSING', 'SHIPPED', 'DELIVERED').contains(order.status) == false
   )
}
```

Result:

```json
{
  "validOrders": [
    {
      "id": "order-1",
      "status": "PENDING"
    },
    {
      "id": "order-2",
      "status": "SHIPPED"
    }
  ],
  "invalidOrders": [
    {
      "id": "order-3",
      "status": "CANCELED"
    }
  ]
}
```
