# Use expressions in task arguments

> **About this page**
>
> - Kind: How-to guide
> - Summary: Pass run inputs, other tasks' outputs, functions and fallbacks into a task's arguments with expressions.
> - Last changed: 2026-11-17
> - Page: https://docs.swale.io/how-to-guides/use-expressions-in-task-arguments
> - 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.

This guide shows how to pass values into a task's arguments with `${{...}}` expressions: run inputs, other tasks' outputs, and values built with operators and functions. The [expression language reference](https://docs.swale.io/reference/expression-language.md) lists every value an expression can read.

## Reference a run input

Pass a run input directly to a task argument:

```yaml
name: Upload example
compute_type: cpu-4
inputs:
  bucket_name: {}

blocks:
  main:
    tasks:
      upload:
        name: Upload
        uses: my-account/upload-task@1.0.0
        args:
          bucket: ${{inputs.bucket_name}}
```

## Reference a task output

Pass the output of one task to the argument of a downstream task:

```yaml
name: Output example
compute_type: cpu-4
blocks:
  main:
    tasks:
      fetch:
        name: Fetch
        uses: my-account/fetch-task@1.0.0
      process:
        name: Process
        uses: my-account/process-task@1.0.0
        start_on:
          - fetch
        args:
          data_path: ${{tasks.fetch.outputs.file_path}}
```

`process` does not start until `fetch` is Complete, at which point `${{tasks.fetch.outputs.file_path}}` resolves to the value `fetch` wrote to the `file_path` output.

A task reads only the outputs of the tasks it waits on, so list the task that writes the output in `start_on`, directly or through the tasks in between. A task that runs alongside without that link reads null. See [Task outputs](https://docs.swale.io/reference/expression-language.md#task-outputs) for the full rule, including the blocks of if and `for_each` tasks.

## Combine operators and functions

Use functions and operators to build richer arguments:

```yaml
args:
  label: ${{format('Run {0} of {1}', inputs.run_number, inputs.total_runs)}}
  is_final: ${{inputs.run_number == inputs.total_runs}}
  owner: ${{inputs.owner || 'unassigned'}}
```

`is_final` becomes the text `true` or `false`, and `owner` falls back to `unassigned` when the input is falsy: empty, not supplied, or `0` or `false`. Expressions have no arithmetic operators.

## Mix static text and expressions

An expression can appear anywhere in a string value alongside static text:

```yaml
args:
  message: 'Processing ${{inputs.bucket_name}} for run ${{inputs.run_number}}'
```

Secrets and the loop variables of a `for_each` task are passed the same way; see [Use secrets in workflows](https://docs.swale.io/how-to-guides/use-secrets-in-workflows.md) and [Iterate over a list with for_each](https://docs.swale.io/how-to-guides/iterate-over-a-list-with-for-each.md).

## Next steps

- [Expression language reference](https://docs.swale.io/reference/expression-language.md)
- [Expression functions reference](https://docs.swale.io/reference/expression-functions.md)
- [How expressions work](https://docs.swale.io/explanation/how-expressions-work.md)
