I have a Human class with a function that takes any amount of people and determines if someone is older than any of those people, then returns an array with the people he/she is older than.
func isOlderThan(people: Human...) -> [Human] {
var p: [Human]
for person in people {
if age > person.age {
p.append(person)
}
}
return p
}
However at
p.append(person)
I'm getting the error
Variable p passed by reference before being initialized
Anyone sure why this is? Thanks!