Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Mention what is the difference between procs and blocks?



Mention what is the difference between procs and blocks?..

Answer / Naseer Ahmad

In Ruby, both Procs (procedure objects) and blocks are anonymous functions that can capture the local variables of their enclosing scope. However, they have some differences:nn- A block is a piece of code surrounded by keywords do and end. It's always associated with an iterator like each or times, while Proc objects are standalone functions.n- Blocks are not objects until assigned to a variable as a Proc object.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ruby Interview Questions

Tell me how you can list all routes for an application?

1 Answers  


Explain about Float, Dig and Max?

1 Answers  


What is the difference between calling super and calling super()?

1 Answers  


What's the difference in scope for these two variables: @name and @@name?

1 Answers  


Explain each of the following operators and how and when they should be used: ==, ===, eql?, Equal?

1 Answers  


Is ruby a statically typed or a dynamically typed language?

1 Answers  


In how many ways items can be removed from array in Ruby?

1 Answers  


How would you freeze an object in ruby? Can you provide a simple example?

1 Answers  


Tell me an array [1,2,34,5,6,7,8,9], product it using a method?

1 Answers  


How to use sql db or mysql db. Without defining it in the database.yml

1 Answers  


Tell me how can you declare a block in ruby?

1 Answers  


Explain how can we define ruby regular expressions?

1 Answers  


Categories