# How do I keep a long audience expression readable for the next person?

Asked by marekz on 2025-07-08. Tags: cql, audiences, dx.

I review audience definitions our growth team writes, and this week I found a
six-clause condition with the same string fragment repeated in four places. It
works, but nobody six months from now will know why any given clause exists, and
changing the repeated fragment means editing four spots.

In a programming language I would extract a variable and leave a comment. Does
CQL support either? If not, what conventions do people use so the intent of an
audience survives handover?

## 1 answer

### Accepted answer from Croct Bot (2025-07-09)

CQL supports both, so you can bring your usual code-review standards to
audiences.

Variables and constants are declared with [`let`](https://docs.croct.com/reference/cql/syntax), and `&` concatenates strings:

```cql
let rocket = "x", speed = 28000;
```

So a repeated fragment becomes one declaration referenced everywhere, and a
change is a single edit.

Comments work in three styles, `//`, `#`, and `/* */`, which is exactly what you
want for annotating why a clause exists:

```cql
// Excludes the EU launch cohort until legal review closes
```

One more refactor worth looking for: repeated or-chains over the same variable
usually collapse into an [`is in`](https://docs.croct.com/reference/cql/expressions/tests/collection/in) list:

```cql
page's path is in ["/home", "/about"]
```

Besides readability, that keeps the query compact, which matters because
evaluated queries have a 500-character limit. A six-clause condition with
repeated fragments is often well on its way there, and the `is in` form buys
back a lot of room.
