有什么方法可以将单组 const 增加固定数量而不是 1?
Is there any way to increase single group of const by a fixed number rather than 1?
我有一组常量:
const (
a = 100
b = 200
c = 300
)
我想知道是否有任何方法可以使用 iota
关键字而不是手动分配每个值?
如official reference中所述,可以使用 iota 的位移位来增加数字,但我想增加一个固定数字,例如 100。
const (
_ = iota * 100
a
b
c
)
我有一组常量:
const (
a = 100
b = 200
c = 300
)
我想知道是否有任何方法可以使用 iota
关键字而不是手动分配每个值?
如official reference中所述,可以使用 iota 的位移位来增加数字,但我想增加一个固定数字,例如 100。
const (
_ = iota * 100
a
b
c
)