Ruby: explain me this lambda | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Ruby: explain me this lambda

x = lambda{|a =2,b|} puts x.lambda? Why is it true?

27th Jun 2019, 6:28 PM
Paolo De Nictolis
Paolo De Nictolis - avatar
1 Answer
+ 2
Because "lambda?" method verify if variable is a lamda function. You declare x and assign it a lambda function, so "true" is the right response...
2nd Jul 2019, 5:50 AM
Nifriz
Nifriz - avatar