A way to do what you seem to be trying to do is:
mutating func accumulate() -> Double {
tickets = tickets.map {
var copy = $0
copy.price += 2.0
return copy
}
return tickets.reduce(0) {$0 + $1}
}
A way to do what you seem to be trying to do is:
mutating func accumulate() -> Double {
tickets = tickets.map {
var copy = $0
copy.price += 2.0
return copy
}
return tickets.reduce(0) {$0 + $1}
}