How does Go return multiple values
This article mainly explains "how Go returns multiple values". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how Go returns multiple values".
Function returns multiple values
The Go function can return multiple values, such as:
Example
Package main
Import "fmt"
Func swap (x, y string) (string, string) {
Return y, x
}
Func main () {
A, b: = swap ("Google", "Runoob")
Fmt.Println (a, b)
}
The execution result of the above example is:
Runoob Google thank you for reading, the above is the content of "how Go returns multiple values". After the study of this article, I believe you have a deeper understanding of how Go returns multiple values, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!