Swift - Functions
What is the output of this Swift code?
func divide(_ a: Int, by b: Int) -> Int {
return a / b
}
print(divide(10, by: 2))func divide(_ a: Int, by b: Int) -> Int {
return a / b
}
print(divide(10, by: 2))_ so no label needed; second parameter label is by.divide(10, by: 2) divides 10 by 2, returning 5, which is printed.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions