mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-30 18:10:20 +02:00
Slight language change per pull req. comment
This commit is contained in:
@@ -118,9 +118,9 @@ can include line breaks.` // Same string type.
|
|||||||
|
|
||||||
// It is possible, unlike in many other languages for functions in go
|
// It is possible, unlike in many other languages for functions in go
|
||||||
// to have named return values.
|
// to have named return values.
|
||||||
// We just have to assign a name to the type being returned in the function
|
// Giving a name to type being returned allows us to easily return from
|
||||||
// declaration line. This allows us to easily return from multiple points
|
// multiple points in a function as well as to only use the return keyword,
|
||||||
// in a function as well as to only use the return keyword, without anything further.
|
// without anything further.
|
||||||
func learnNamedReturns(x, y int) (z int) {
|
func learnNamedReturns(x, y int) (z int) {
|
||||||
z = x * y
|
z = x * y
|
||||||
return // z is implicit here, because we named it earlier.
|
return // z is implicit here, because we named it earlier.
|
||||||
|
Reference in New Issue
Block a user