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 |
What is ruby object?
Tell me how can we define ruby regular expressions?
Tell us how would you implement hash in ruby internally?
What are the data types in ruby?
Explain the use of retry statement in ruby?
What's the difference in scope for these two variables: @name and @@name?
What are Ruby arrays and how they can be created?
How to write multiline string in Ruby?
Explain ampersand parameter (&block) in Ruby?
How does ruby deal with extremely large numbers?
What must you do first before you can invoke an unboundmethod object?
List some features of ruby?