我遇到了这个错误(参见图片),但我不知道该如何解决它?
代码:
t = 3
seps = StaticArray(Int32, t).new{
2
}
seps.each{|i| p i}
错误 :
Syntax error in eval:2: expecting token ')', not 't'
当我像这样初始化StaticArray时它可以工作:
seps = StaticArray(Int32, 3).new{
2
}
seps.each{|i| p i}
但我需要像代码的第一个示例那样初始化数组!