Why is it that when I create arr, an array then try to populate it with integers using a for-in loop it, gives me an error when I don't initialize it. From what I can tell it is initialized when I write "var arr," but obviously not so what does writing var arr actually do if not initialize it.
Error Example
var arr : [Int] //Error Message: Variable 'arr' passed by reference before being initialized
for i in 1...10 {
arr += [i]
}
arr //Error Message: Variable 'arr' used before being initialized
Working Example
var arr : [Int] = [] //Allocating memory?
for i in 1...10 {
arr += [i]
}
arr
!after[Int]I think you shouldn't receive that message.'[Int]!' is not identical to 'UInt8'