Proc and Lamda Flashcards
1
Q
Which one the method to call the lambda?
A
my_lambda = -> { puts “Lambda called” }
a) my_lambda.call
b) my_lambda.()
c) my_lambda[]
d) my_lambda.===
2
Q
times_two = ->(x) { x * 2 }
times_two.call(10)
Is this code valid?
What is the output of this code?
A
Its the other way of defining Lambda.
output
20
3
Q
proc and lambda are supported by a class. True or False? If so mention the class name
A
yes. Procedure or simply Proc