# Wrapper Types

{% hint style="info" %}
Wrapper types are equivalent to "Named Types" in Golang
{% endhint %}

## Wrapper Type Syntax

```fsharp
wrapper <existing type to be wrapped> <Wrapper type name>
```

## Working Example

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

```fsharp
package main

import "fmt" as fmt

wrapper Int Dollars

fun addDollars(currentAmount: Dollars, amountToAdd: Int): Dollars {
  return Dollars(((Int)(currentAmount)) + amountToAdd)
}

fun printDollars(amount: Dollars): Unit {
  fmt.println(amount)
}

fun main(): Unit {
  let dollarsIHave = Dollars(100)
  let newAmount = addDollars(dollarsIHave, 900)
  printDollars(newAmount)
}
```

{% endtab %}

{% tab title="Transpiled" %}

```go
package main

import fmt "fmt"

type dollars int

func addDollars(currentAmount dollars, amountToAdd int) dollars {

        return dollars((int(currentAmount)) + amountToAdd)

}

func printDollars(amount dollars) {
        fmt.Println(amount)

}

func main() {
        dollarsIHave := dollars(100)
        newAmount := addDollars(dollarsIHave, 900)
        printDollars(newAmount)
        // Eliminates any 'unused variable' errors
        _, _ = dollarsIHave, newAmount

}

```

{% endtab %}

{% tab title="Output" %}

```
1000
```

{% 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/wrapper-types.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.
