我是 Golang 的新手,希望解释以下作业
I'm new to Golang and would like to have the following assignment explained
我是 Golang 的新手,希望向我解释以下代码,尤其是分配 Pos(0)
时的最后一部分。 Pos(0)
到底是什么?谢谢!
type Pos uint
var NoPos = Pos(0)
这是一个 type conversion。它可以将 0
转换为类型 Pos
。它也可以在没有像这样的转换的情况下重写:
var NoPos Pos = 0
我是 Golang 的新手,希望向我解释以下代码,尤其是分配 Pos(0)
时的最后一部分。 Pos(0)
到底是什么?谢谢!
type Pos uint
var NoPos = Pos(0)
这是一个 type conversion。它可以将 0
转换为类型 Pos
。它也可以在没有像这样的转换的情况下重写:
var NoPos Pos = 0