# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
