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

枚举和位移

时间:2017-10-31 22:16:48      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:class   iot   import   style   main   code   span   位移   fun   

package main

import (
    "fmt"
)

const (
    B float64 = 1 << (iota * 10)
    KB
    MB
    GB
)

func main() {
    fmt.Println(B)
    fmt.Println(KB)
    fmt.Println(MB)
    fmt.Println(GB)
}

  1
    1024
    1.048576e+06
    1.073741824e+09

枚举和位移

标签:class   iot   import   style   main   code   span   位移   fun   

原文地址:http://www.cnblogs.com/Erick-L/p/7763918.html

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