Ruby functions vs methods

前端 未结 3 1481
小蘑菇
小蘑菇 2020-12-14 01:27

In the Ruby Programming Language, Chapter 6 (second paragraph) they state:

Many languages distinguish between functions, which have no associated

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-14 01:50

    Procs and lambdas are both objects unto themselves, with a call method that actually invokes the block associated with the proc (or lambda). However, Ruby provides some syntactic sugar to invoke them without the explicit call to call.

提交回复
热议问题