Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function Overloading - Multiple function with the same name

  • There is no function overloading in Golang
package main

import "fmt"

func main() {
}

func say() {
	fmt.Println("Hello World")
}

func say(name string) {
	fmt.Printf("Hello %v\n", name)
}
# command-line-arguments
./redeclare_function.go:12:6: say redeclared in this block
	previous declaration at ./redeclare_function.go:8:6