首页 > 其他 > 详细

functions _ golang

时间:2015-03-14 18:29:31      阅读:213      评论:0      收藏:0      [点我收藏+]

Functions are central in Go. We‘ll learn about functions with a few different examples

package main

import (
    "fmt"
)

func plus(a int, b int) int {
    return a + b
}

func plusPlus(a, b, c int) int {
    return a + b + c
}

func main() {
    res := plus(1, 2)
    fmt.Println("1 + 2 = ", res)

    res = plusPlus(1, 2, 3)
    fmt.Println("1 + 2 + 3 = ", res)
}
1 + 2 =  3
1 + 2 + 3 =  6

总结 :

  1 : ......

functions _ golang

原文:http://www.cnblogs.com/jackkiexu/p/4337850.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!