> For the complete documentation index, see [llms.txt](https://gauntletlang.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gauntletlang.gitbook.io/docs/advanced-features/pipes.md).

# Pipes

## Pipe Syntax

```fsharp
expr |> someFunctionCall(<args with at least one underscore>)
```

The pipe (`|>`) takes the expression on the left and "pipes" it into the function right, wherever there are underscores.

{% hint style="warning" %}
For every underscore you use, a new instance of the left-hand expression will be made. For instance, `myExpr |> someFunction(_, _)` turns into `someFunction(myExpr, myExpr)`. This many result in unwanted side-effects.&#x20;
{% endhint %}

## Working Example

{% tabs %}
{% tab title="Gauntlet" %}

```fsharp
package main

import "fmt" as fmt

fun add(num: Int, addend: Int): Int {
  return num + addend
}

fun subtract(num: Int, subtrahend: Int): Int {
  return num - subtrahend
}

fun multiply(num: Int, multiplier: Int): Int {
  return num * multiplier
}

fun divide(num: Int, divisor: Int): Int {
  return num / divisor
}

fun Unit main() {
  10
  |> add(_, 10)
  |> add(_, 30)
  |> divide(_, 2)
  |> subtract(_, 5)
  |> divide(_, 2)
  |> multiply(_, 10)
  |> fmt.println(_)
}
```

{% endtab %}

{% tab title="Transpiled" %}

```go
package main

import fmt "fmt"

func add(num int, addend int) int {

	return num + addend

}

func subtract(num int, subtrahend int) int {

	return num - subtrahend

}

func multiply(num int, multiplier int) int {

	return num * multiplier

}

func divide(num int, divisor int) int {

	return num / divisor

}

func main() {
	fmt.Println(multiply(divide(subtract(divide(add(add(10, 10), 30), 2), 5), 2), 10))

}

```

{% endtab %}

{% tab title="Output" %}

```
100
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gauntletlang.gitbook.io/docs/advanced-features/pipes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
