How can I deal with this error without creating additional variable?
func reduceToZero(x:Int) -> Int { while (x != 0) { x = x-1 //
There are some cases where we dont ned to use inout
inout
We can use something like this if you want that changes/scope to be only inside the function:
func manipulateData(a: Int) -> Int { var a = a // ... }