func greetingMaker(greeting: String) -> (String) -> String {
return {
"\(greeting), \($0)"
}
}
let hello = greetingMaker(greeting: "Hello")
hello("world") // "Hello, World"
Created
June 17, 2022 19:18
-
-
Save iAmWillShepherd/d011b0a9d1fce3c8a1fe70d25b5db394 to your computer and use it in GitHub Desktop.
How to return a closure from a function.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment