我四处寻找,但找不到创建这样的数组的方法:
var array:[Int] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0..
无需输入一百个零和逗号。有没有一种简单的方法可以做到这一点?感谢您抽出时间。
最佳答案
怎么样
var array = [Int](count: 100, repeatedValue: 0)
关于arrays - Swift 中的数组语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26813640/