how func works in swift code example
Example 1: declare function in swift
func greet(person: String) -> String {
let greeting = "Hello, " + person + "!"
return greeting
}
Example 2: swift how to call a function
//function trying to be called
func aFunction() {
print("called function")
}
//call function like this
aFunction()