> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
