mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Added some information on the naked results, text and example taken from A Tour of Go
parent
0d20d71c9d
commit
8374519012
@ -472,6 +472,16 @@ it in a deferred closure. That is always OK.
|
||||
|
||||
## Naked Returns
|
||||
|
||||
A `return` statement without arguments returns the named return values. This is known as a "naked" return.
|
||||
|
||||
```go
|
||||
func split(sum int) (x, y int) {
|
||||
x = sum * 4 / 9
|
||||
y = sum - x
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
See [Named Result Parameters](#named-result-parameters).
|
||||
|
||||
## Package Comments
|
||||
|
Loading…
x
Reference in New Issue
Block a user