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...


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



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

Answer / Ravi Tewari

In Ruby, @name is an instance variable which belongs to a specific object instance. It has a different value for each object of the same class. On the other hand, @@name is a class variable, it is shared among all instances of the class, and it has the same value for every object of that particular class.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ruby Interview Questions

What is ruby object?

1 Answers  


Tell me how can we define ruby regular expressions?

1 Answers  


Tell us how would you implement hash in ruby internally?

1 Answers  


What are the data types in ruby?

1 Answers  


Explain the use of retry statement in ruby?

1 Answers  


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

1 Answers  


What are Ruby arrays and how they can be created?

1 Answers  


How to write multiline string in Ruby?

1 Answers  


Explain ampersand parameter (&block) in Ruby?

1 Answers  


How does ruby deal with extremely large numbers?

1 Answers  


What must you do first before you can invoke an unboundmethod object?

1 Answers  


List some features of ruby?

1 Answers  


Categories