I am reading some books about the functional programming in swift. When I see some books said the function in swift is "first-class function" and I confused what is the meaning of the "first-class". Can anybody answer me or give me some example code?
Best How To :
Functions are first-class citizens in Swift because you can treat a function like a normal value. For example, you can …
- assign a function to a local variable,
- pass a function as an argument to another function, and
- return a function from a function.