Explain about Class variable and global variable?
Answer / Mohit Rajan
Class variables are variables that are defined within a class or module and share their value across all instances of the class. They are prefixed with two '@' symbols (e.g., @@my_class_var). Global variables, as mentioned earlier, can be accessed anywhere in the program without an explicit qualifier and are prefixed with '$'. While global variables have broader scope, class variables help maintain shared state across instances of a class.
| Is This Answer Correct ? | 0 Yes | 0 No |
How many types of associations relationships does a model has?
Why Ruby is known as a language of flexibility?
How does ruby deal with extremely large numbers?
What does mri most commonly stand for?
Explain about ruby code blocks?
What is yield statement in ruby.
What are ruby variables.
Explain how Symbol is different from variables?
Explain some of the looping structures available in ruby?
Explain ruby data types.
Tell me what is the role of sub-directory app/controllers and app/helpers?
What is a struct in ruby?