Chinaunix首页 | 论坛 | 博客
  • 博客访问: 30752
  • 博文数量: 11
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 100
  • 用 户 组: 普通用户
  • 注册时间: 2014-10-19 21:19
文章分类
文章存档

2015年(2)

2014年(9)

我的朋友

分类: 敏捷开发

2014-11-24 21:17:37


点击(此处)折叠或打开

  1. // Variables
  2. package main

  3. import (
  4.     "fmt"
  5. )

  6. func main() {
  7.     var a string = "initial"
  8.     fmt.Println(a)
  9.     //You can declare multiple variables at once.
  10.     var b, c int = 1, 2
  11.     fmt.Println(b, c)
  12.     //Go will infer the type of initialized variables.
  13.     var d = true
  14.     fmt.Println(d)
  15.     //Variables declared without a corresponding initialization are zero-valued. For example, the zero value for an int is 0.
  16.     var e int
  17.     fmt.Println(e)
  18.     //The := syntax is shorthand for declaring and initializing a variable, e.g. for var f string = "short" in this case.
  19.     f := "short"
  20.     fmt.Println(f)
  21. }
转自
阅读(816) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~