swift declare function as variable code example
Example 1: declare function in swift
func greet(person: String) -> String {
let greeting = "Hello, " + person + "!"
return greeting
}
Example 2: swift function in a variable
var pendingFunction: ((Double, Double) -> Double)