GO语言单位表示

Posted JohnRey

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GO语言单位表示相关的知识,希望对你有一定的参考价值。

package main

import(
    "fmt"
)

const(
    B float64 = 1 <<(iota * 10)
    KB
    MB
    GB
    TB
    PB
    EB
    ZB
    YB
)

func main() {
    fmt.Println(B)
    fmt.Println(KB)
    fmt.Println(MB)
    fmt.Println(GB)
    fmt.Println(TB)
    fmt.Println(PB)
    fmt.Println(EB)
    fmt.Println(ZB)
    fmt.Println(YB)
}

 

以上是关于GO语言单位表示的主要内容,如果未能解决你的问题,请参考以下文章