iota Magical

itoa formula can be set, the following will still follow Math

package main

import "fmt"

func main() {
    const (
        b = 1 << (10 * iota)
        kb
        mb
        tb
        pb
    )
    fmt.Println(b, kb, mb, tb, pb) //1 1024 1048576 1073741824 1099511627776
}




Guess you like

Origin www.cnblogs.com/hualou/p/12070072.html