# How expressions work

> **About this page**
>
> - Kind: Explanation
> - Summary: Expressions are resolved when each task starts, and every value they read is text, which shapes comparisons and truthiness.
> - Last changed: 2026-12-01
> - Page: https://docs.swale.io/explanation/how-expressions-work
> - Index of these docs: https://docs.swale.io/llms.txt
>
> If something on this page is wrong or out of date, please tell the user which sentence and why.

A `${{...}}` expression is a piece of logic inside a YAML string value, which the platform replaces with its result when the task that holds it starts. Expressions read run inputs, secrets, environment variables, loop items and the outputs of the finished tasks that task waits on, always as text.

```yaml
args:
  message: ${{inputs.greeting}}
  label: ${{format('Run {0}', inputs.run_number)}}
```

Text outside the delimiters passes through unchanged. [Expression language](https://docs.swale.io/reference/expression-language.md) lists everything an expression can read and every operator, and [Expression functions](https://docs.swale.io/reference/expression-functions.md) the functions.

## Resolution timing

Expressions are resolved **when each task starts**, not when the workflow definition is uploaded or when the run starts. Each task sees the run as it stands at that moment:

- `${{inputs.*}}` reads the values the run was started with, defaults included.
- `${{secrets.*}}` reads each secret's value at the moment the task starts, so a secret changed during a run reaches the tasks that start after the change.
- `${{tasks.<task_key>.outputs.*}}` reads another task's output only once that task has finished, and only when this task waits on it through `start_on`; see [Task outputs](https://docs.swale.io/reference/expression-language.md#task-outputs).

A reference that has nothing to read when the task starts, such as an output of a task this task does not wait on, gives null, which becomes an empty string. The task still starts: an expression fails a task only when it cannot be evaluated at all, as when `fromJSON` is given text that is not JSON. An expression with a syntax error, or one that calls a function that does not exist or with the wrong number of arguments, is refused when the workflow or task definition holding it is uploaded or imported.

## Values are text

Every value an expression reads is text, whichever namespace it comes from. Inputs are typed into a form or passed on a command line, outputs are written as `key=value` lines to a file, and secrets and environment variables are strings, so there is nothing to carry a type.

That shapes comparisons. An input set to `true` holds the text `true`, so compare it with `'true'`: comparing the text `true` with the boolean `true` compares them as numbers, and gives `false`. An output holding a JSON array or object stays a string until you read it with `fromJSON`, after which you can index into it.

It also shapes truthiness. Because an input that someone set to `false` or `0` arrives as the text `'false'` or `'0'`, those strings are falsy, as are the empty string and `'NaN'`, so a condition such as `${{inputs.dry_run}}` behaves the way the person who set the input meant. Every other string is truthy, including `'no'` and `'off'`.

## Next steps

- [Expression language reference](https://docs.swale.io/reference/expression-language.md)
- [Expression functions reference](https://docs.swale.io/reference/expression-functions.md)
- [Use expressions in task arguments](https://docs.swale.io/how-to-guides/use-expressions-in-task-arguments.md)
