Just use int()
:
x := float32(3.1)
fmt.Println(int(x))
Which produces 3
as needed, without having to use string conversions or the like.
Just use int()
:
x := float32(3.1)
fmt.Println(int(x))
Which produces 3
as needed, without having to use string conversions or the like.