Functions
func declares a function with typed parameters and a return type. Labels make calls read well.
Example
func add(_ a: Int, to b: Int) -> Int { a + b }
func greet(name: String) -> String { "Hello \(name)" }
print(add(2, to: 3))
print(greet(name: "Ada"))Exercise
Return arrow.
func f() Int
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.