Functions in Go
Golang Concepts
Go: Functions
Functions are very important part of Golang and one of Go's unusual features is that functions and methods can return multiple values as well.
here is an example of functions
package main
import "fmt"
func plus(a int, b int) int {
return a + b
}
func plusPlus(a, b, c int) int {
return a + b + c
}
func main() {
res := plus(1, 2)
fmt.Println("1+2 =", res)
res = plusPlus(1, 2, 3)
fmt.Println("1+2+3 =", res)
}
Multiple Return Values Functions
package main
import "fmt"
The (int, int) in this function signature shows that the function returns 2 ints.
func sumAndMultiply() (x int, y int) {
return x+y, x*y
}
func main() {
s, m := vals()
fmt.Println(s)
fmt.Println(m)
//If you only want a subset of the returned values, use the blank identifier _.
_, c := vals()
fmt.Println(c)
}
To Understand functions in details read this article Functions in Go

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
