mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Hopefully slight language improvement over orig.
This commit is contained in:
parent
9448404709
commit
e881ba74f3
@ -118,9 +118,9 @@ can include line breaks.` // Same string type.
|
||||
|
||||
// It is possible, unlike in many other languages for functions in go
|
||||
// to have named return values.
|
||||
// Giving a name to type being returned allows us to easily return from
|
||||
// multiple points in a function as well as to only use the return keyword,
|
||||
// without anything further.
|
||||
// Assigning a name to the type being returned in the function declaration line
|
||||
// allows us to easily return from multiple points in a function as well as to
|
||||
// only use the return keyword, without anything further.
|
||||
func learnNamedReturns(x, y int) (z int) {
|
||||
z = x * y
|
||||
return // z is implicit here, because we named it earlier.
|
||||
|
Loading…
Reference in New Issue
Block a user