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

A Tour of Go Variables with initializers

时间:2014-10-26 20:59:53      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   ar   java   sp   div   on   

A var declaration can include initializers, one per variable.

If an initializer is present, the type can be omitted; the variable will take the type of the initializer.

package main 

import "fmt"

var i, j int = 1,3
var c, python, java = true, false, "no!"

func main() {
    fmt.Println(i, j, c, python, java)
}

 

A Tour of Go Variables with initializers

标签:style   blog   color   io   ar   java   sp   div   on   

原文地址:http://www.cnblogs.com/ghgyj/p/4052618.html

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