What is the use of global variable $ in Ruby?
Answer / Sudha Devi
$ is a prefix for global variables in Ruby. It means that any variable prefixed with a $ sign can be accessed from anywhere within your program. However, it's generally discouraged to use global variables as they can lead to naming conflicts and make code harder to manage.
| Is This Answer Correct ? | 0 Yes | 0 No |
What things we can define in the model?
Tell me how would you freeze an object in ruby? Can you provide a simple example?
Name different methods for io console in ruby?
What are the different uses of ruby modules?
Explain ruby strings.
Explain ruby ranges. What are the ways to define ranges?
Define ruby methods.
Explain case statement in Ruby?
Explain the concepts and capabilities of garbage collection feature of Ruby?
How to check whether a directory exist or not in Ruby?
What must you do first before you can invoke an unboundmethod object?
Ruby support single inheritance/multiple inheritance or both?