What is the main difference between procs and blocks?



What is the main difference between procs and blocks?..

Answer / Chandra Bhan Singh

In Ruby, Procs (procedure objects) are self-contained chunks of code that can be passed around and executed on demand. They can capture the state of the local variables when defined. On the other hand, Blocks are pieces of code written inside methods or within Proc literals. Blocks are used to pass code as arguments.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ruby on Rails Interview Questions

ruby on rails and java ,which of one of the best in future &present?

1 Answers  


What is rails script? Name some of them?

1 Answers  


Tell me what is mixin in rails?

1 Answers  


Write a program to generate and run the application without the use of database

1 Answers  


write a program to show the usage of sql in the database file?

1 Answers  


what is Rails Migration?

1 Answers  


what is the defined operator?

1 Answers  


What is the main function of helpers used in ruby on rails?

1 Answers  


Do you know what is rake in rails?

1 Answers  


what is the difference between new, save and create?

1 Answers  


Mention the role of rails controller.

1 Answers  


What are filters? and how many types of filters are there in ruby

2 Answers   Baidu, TCS,


Categories