# 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: 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/methods.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.
