“Functions are a first-class type” in swift?

后端 未结 5 1299
北海茫月
北海茫月 2021-02-03 13:21

the little knowledge , I have about first class function is that it supports passing functions as arguments and we can also return them as the values in another function ... I a

5条回答
  •  旧巷少年郎
    2021-02-03 14:12

    Properties of First class function

    1. A function is an instance of the Object type.
    2. You can store the function in a variable.
    3. You can pass the function as a parameter to another function.
    4. You can return the function from a function.
    5. You can store them in data structures such as hash tables, lists, …

    refer https://www.geeksforgeeks.org/first-class-functions-python/

提交回复
热议问题