每个人都有自己的知识体系。
Toggle navigation
Home
随笔
C#/.Net
树莓派 / Raspberry
皓月汉化组
Beego
Golang
OxideMod
apache
haproxy
windows
Java
Objective-C
日语/罗马音歌词/日语常识
MongoDB
python
电学
公告
Minecraft服务器-公告
NanoPi
C4D (CINEMA 4D)
生活
推流/m3u8/rtmp/rtsp
Unity3d
ffmpeg
数据结构
区块链
tarui
UnityForPSVita
About Me
Archives
Tags
Go 笔记 - 1-11 iota枚举
2018-10-11 17:35:46
145
0
0
akiragatsu
package main import "fmt" func main() { //1、iota常量自动生成器 每隔一行 自动累加1 //2、iota给常量赋值 const ( a = iota //0 b = iota //1 c = iota //2 ) fmt.Printf("a = %d,b = %d,c = %d\n", a, b, c) //3 iota 遇到const 就会重置为0 const d = iota fmt.Printf("d = %d\n", d) //可以只写一个iota const ( a1 = iota //0 b1 //1 c1 //2 ) fmt.Printf("a1 = %d,b1 = %d,c1 = %d\n", a1, b1, c1) //5 如果在同一行 值都一样 const ( i = iota j1, j2, j3 = iota, iota, iota k = iota ) fmt.Printf("i = %d,j1 = %d,j2 = %d,j3 = %d\n,k = %d\n", i, j1, j2, j3, k) }
Pre:
Go 笔记 - 1-12 类型的分类
Next:
Go 笔记 - 1-10 多个变量或常量定义
0
likes
145
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Submit
Sign in
to leave a comment.
No Leanote account?
Sign up now.
0
comments
More...
Table of content
No Leanote account? Sign up now.