Introduction
Functions are first-class in Swift so you can use them like any other value. This means you can store them, pass them around, and use them easily.
When you want to pass a piece of work to another part of your code.
When you want to store different actions in a list or variable.
When you want to create flexible code that can change behavior.
When you want to return a function from another function.
When you want to simplify repeated tasks by reusing code blocks.