How to use for loop to create Int array in Swift 3

Your array is empty and you are subscripting to assign value thats why you are getting "Array index out of range" crash. If you want to go with for loop then.

var integerArray = [Int]()
for i in 0...100 {
    integerArray.append(i)
}

But instead of that you can create array simply like this no need to use for loop.

var integerArray = [Int](0...100)

Without using loops:

var integerArray = Array(0...100)

Without using loops 2:

var integerArray = (0...100).map{ $0 }

Without using loops 3:

var integerArray = [Int](0...100)

Using loops (better do not use) :

var integerArray = [Int]()
for i in 0...100 { integerArray.append(i) }