Functions

//"inout": the value goes outward
//through the argument
func getSum(_ sum: inout Int,
    _ n1: Int, _ n2: Int) {
    sum = n1 + n2
}

var sum = 0
getSum(&sum, 53)
//sum is 8

//a tuple result is used more often
func divide(_ a: Int, by b: Int)
    -> (quotient: Int, remainder: Int) {
    (a / b, a % b)
}

let result = divide(17, by: 5)
//result is (3, 2)

print("sum is \(sum)")
print("quotient is \(result.quotient)")
print("remainder is \(result.remainder)")