Learn
Great work! Closures are an important tool in Swift that allows you to write and use higher-ordered functions. In this lesson, you learned how to:
- Define closures
- Pass closures to functions
- Use trailing closure syntax and closure syntax sugar
- Call built-in higher-order functions like
filter
- Mark closures as
@escaping
so they can be stored for later - Capture values inside a closure
Using closures and higher-ordered functions can be a great way to make your code more compact and readable!
Instructions
Feel free to utilize the empty Review.swift file and output terminal on the right to hone your understanding of closures.
Click on “Up Next” when you’re ready to move on.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.