Keyword
Go return keyword
Ends the current function and supplies its declared results. A bare return is possible with named results (subject to scope restrictions) or no results. Deferred calls run before control reaches the caller. Example prints 5.
Formal Syntax & Structure
go syntaxgo
return [expressionList]Working Example
Example Snippetgo
package main
import "fmt"
func difference(a, b int) int { return a - b }func main() { fmt.Println(difference(9, 4))}