Vidyalelo
Ruby Programming · Q5

Blocks and Procs in Ruby

Programming · Ruby Programming · question 5

Q5

What is the difference between a block and a proc in Ruby?

A.
A proc can be passed directly to methods, while a block needs to be converted into an object
B.
A proc is an anonymous function, while a block is a named function
C.
A block can be passed directly to methods, while a proc needs to be converted into an object
Answer
D.
A block is an anonymous function, while a proc is a named function

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board