Ben Chuanlong Du's Blog

It is never too late to learn.

Integers in Golang

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

In [14]:
import "math"
import "strconv"
In [3]:
var f float64 = 3.2
var v uint = uint(f)
v
Out[3]:
3
In [6]:
uint(f)
Out[6]:
3
In [7]:
uint(3.2)
untyped constant {float64 16/5} overflows <uint>
In [10]:
strconv.Itoa(3)
Out[10]:
3
In [15]:
math.Max(1, 2)
Out[15]:
2
In [ ]:
 

Comments