# Keys macro

Learn how to get the keys of a collection.

This macro gets all the keys or indices of a [collection](/reference/cql/data-types/core/collection).

The output for maps is the list of keys in the order in which they appear in the map. For lists, the result is the zero-based indices of the elements in the list.

## Syntax

This macro has the following syntax:

```cql
keys of /*<collection>*/
```

You can also prefix the macro with a definite article for readability:

```cql
the keys of /*<collection>*/
```

## Parameters

These are the supported parameters:

- `collection`: `collection`

  The collection from which you want to get the keys or indices.

## Examples

Here is an example of how to get the keys of a map:

```cql
keys of ["a": 1, "b": 2, "c": 3] // ["a", "b", "c"]
```

If you pass a list, you get its indices:

```cql
keys of [1, 2, 3] // [0, 1, 2]
```
