As you know ruby provides four types of variables. List them and provide a brief explanation for each?
Answer / Shanu Gupta
Ruby provides four types of variables: local variables, instance variables, class (or singleton) variables, and global variables.n- Local variables are used within methods and blocks. They start with a lowercase letter or an underscore (").n- Instance variables are variables that belong to instances of a class. They start with '@'.n- Class variables are shared among all instances of a class. They start with '@@'.n- Global variables are variables that can be accessed from anywhere in the program and are prefixed with $.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to use sql db or mysql db. Without defining it in the database.yml
Tell me can you call a private method outside a ruby class using its object?
What is the difference between a class and a module?
what is the difference between String and Symbol?
What is the difference between static and dynamic scaffolding?
What is a struct in ruby?
What's the difference in scope for these two variables: @name and @@name?
How would you implement hash in ruby internally?
How an exception is handled in Ruby?
Please explain what is mvc and why do we use it?
What is the use of interpolation in ruby?
How to use ruby methods.