> 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/methods.md).

# Methods

## Method Syntax

```fsharp
def <methodName>(<receiverParamName>: ReceiverType, Parameters): <ReturnType> {
    <method body>
}
```

For syntax of `Parameters` - [Read before Proceeding](/docs/read-before-proceeding.md#common-placeholders-throughout-documentation)

Methods can be implemented **only** on wrapper types and structs.

## Working Example

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

```fsharp
package main

import "fmt" as fmt
import "strconv" as strconv

struct Person {
  FirstName: String
  LastName: String
  Money: Int
  Happy: Bool  
}

def getSummary(person: Person): String {
  let fullName = person.FirstName + " " + person.LastName
  return fullName + " has $" + strconv.Itoa(person.Money) + ". It is " + strconv.FormatBool(person.Happy) + " that he is happy."
}

fun main(): Unit {
  let person = Person{FirstName = "John", LastName = "Doe", Money = 10000, Happy = true}
  fmt.println(person.getSummary())
}
```

{% endtab %}

{% tab title="Transpiled" %}

```go
package main

import fmt "fmt"
import strconv "strconv"

type person struct {
	happy     bool
	money     int
	lastName  string
	firstName string
}

func (person person) getSummary() string {
	fullName := person.firstName + " " + person.lastName

	// Eliminates any 'unused variable' errors
	_ = fullName
	return fullName + " has $" + strconv.Itoa(person.money) + ". It is " + strconv.FormatBool(person.happy) + " that he is happy."
}

func main() {
	person := person{firstName: "John", lastName: "Doe", money: 10000, happy: true}
	fmt.Println(person.getSummary())
	// Eliminates any 'unused variable' errors
	_ = person

}

```

{% endtab %}

{% tab title="Output" %}

```
John Doe has $10000. It is true that he is happy.
```

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