码迷,mamicode.com
首页 > 其他好文 > 详细

multiple return values _ golang

时间:2015-03-14 18:28:55      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

Go has built-in support for multiple return values. This feature is used often in idiomatic Go, for example to return both result and error values from a function

package main

import (
    "fmt"
)

func vals() (int, int) {
    return 3, 7
}

func main() {
    a, b := vals()
    fmt.Println(a)
    fmt.Println(b)

    _, c := vals()
    fmt.Println(c)
}
3
7
7

总结 :

  1 : ....

multiple return values _ golang

标签:

原文地址:http://www.cnblogs.com/jackkiexu/p/4337859.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!