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 are the object-oriented programming features supported by ruby?
Do you know when self.up and self.down method is used?
In how many ways you can compare Ruby string?
How will you rename and delete a file in Ruby?
Explain ruby data types.
In how many ways items can be removed from array in Ruby?
How does ruby deal with extremely large numbers?
How to check whether a directory exist or not in Ruby?
Tell us what is class libraries in ruby?
Tell me how can you declare a block in ruby?
How is an iterator handled in ruby?
Can method names be capitalized?