Fixed the sample code for naked return (#29001)
Wrong function name and wrong variable name
This commit is contained in:
@ -75,12 +75,12 @@ You can name the return types so that you don't need to pass variable to the ret
|
|||||||
```go
|
```go
|
||||||
func duplicate(s string) (first, second string) {
|
func duplicate(s string) (first, second string) {
|
||||||
first = s
|
first = s
|
||||||
last = s
|
second = s
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println(split("Hello world!")) // ("Hello world!", "Hello world!")
|
fmt.Println(duplicate("Hello world!")) // ("Hello world!", "Hello world!")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user