I am new to swift and trying to implement a simple function that takes minimum and max number as input and returns an array with all the numbers in the limit. I am getting an error //Error: Reference to generic type 'Array' requires arguments in <...> may I know what I am missing on?
func serialNumberLimits(minimumNumber n1:Int, maximumNumber n2:Int) -> Array {
// Initialized an empty array
var array = Int[]()
//Initialized a "Temp" variable
var temp:Int = 0
for index in n1..n2 {
temp += n1
n1++
if index == 1 { array.insert(temp, atIndex: 0) }
else { array.insert(temp, atIndex: index-1) }
}
return array
}
[Int](n1 ... n2)gives you an integer array with given range (using the "new" array syntax from Beta 3).