The maximum value for an int type in Go

前端 未结 10 931
无人共我
无人共我 2021-01-29 19:09

How does one specify the maximum value representable for an unsigned integer type?

I would like to know how to initialize min in the loop below

10条回答
  •  迷失自我
    2021-01-29 19:30

    From math lib: https://github.com/golang/go/blob/master/src/math/const.go#L39

    package main
    
    import (
        "fmt"
        "math"
    )
    
    func main() {
        fmt.Printf("max int64: %d\n", math.MaxInt64)
    }
    

提交回复
热议问题