I'm new to Golang and would like to have the following code explained to me, particularly the last part when you assign Pos(0)
. What is Pos(0)
exactly? Thanks!
type Pos uint
var NoPos = Pos(0)
I'm new to Golang and would like to have the following code explained to me, particularly the last part when you assign Pos(0)
. What is Pos(0)
exactly? Thanks!
type Pos uint
var NoPos = Pos(0)
It's a type conversion. It is there to convert 0
to type Pos
. It could also be rewritten without a conversion like this:
var NoPos Pos = 0