For Swift 1 and 2 (for Swift 3 see answer by achi using an inout parameter): Argument of a function in Swift is let by default so change it to var if you need to alter the value
i.e,
func reduceToZero(var x:Int) -> Int {
while (x != 0) {
x = x-1
}
return x
}