# Function dengan Return Multiple Value

Function dengan return multiple value memungkinkan output lebih dari 1 value.

## Contoh *code* 1

```go
package main

import (
	"fmt"
)
	
func main() {
	result1, result2 := sayHi("Dawam")
	fmt.Println(result1, result2)
}

func sayHi(name string) (string, string) {
	return fmt.Sprintf("Hi %s nice to meet you.", name), fmt.Sprintf("Welcome. ")
}

```

```
Hi Dawam nice to meet you. Welcome.
```

## Contoh *code* 2 dengan mengabaikan 1 return value

```go
package main

import (
	"fmt"
)
	
func main() {
	result1, _ := sayHi("Dawam")
	fmt.Println(result1)
}

func sayHi(name string) (string, string) {
	return fmt.Sprintf("Hi %s nice to meet you.", name), fmt.Sprintf("Welcome. ")
}

```

```
Hi Dawam nice to meet you.
```

## Contoh *code* 3

```go
package main

import "fmt"

func RectangleFormula(p, l int) (area int, parameter int) {
	return p * l, 2 * (p + l)
}

func main() {
	a, p := RectangleFormula(20, 30)
	fmt.Println("Area	  :", a)
	fmt.Println("Parameter:", p)
}
```

```
Area      : 600
Parameter: 100
```

Reference:

{% embed url="<https://www.golangprograms.com/go-language/functions.html>" %}


---

# 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://rafli-ramadhan.gitbook.io/golang-example-code-by-topic/tipe-data-reference/function-in-golang/function-dengan-return-multiple-value.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.
