What is a lambda (function)?

后端 未结 23 2267
太阳男子
太阳男子 2020-11-22 04:47

For a person without a comp-sci background, what is a lambda in the world of Computer Science?

23条回答
  •  盖世英雄少女心
    2020-11-22 05:18

    An example of a lambda in Ruby is as follows:

    hello = lambda do
        puts('Hello')
        puts('I am inside a proc')
    end
    
    hello.call
    

    Will genereate the following output:

    Hello
    I am inside a proc
    

提交回复
热议问题