I'm new to swift. I want to add 100 random integers to an array. I have the following working code:
var integers = [Int]()
for i in 1...100 {
integers.append((Int.random(in: 0 ..< 100)))
}
The compiler warns me that I did not use i
inside the scope of the for loop, which is indeed a sensible warning. Is there a way to do some line n
times without declaring a variable which I won't use anyway?