How symbol is different from variables?
Answer / Shashi Kumar
Symbols in Ruby are objects that represent unique identifiers for method names, attribute names, and constant names. Unlike variables, they are immutable and have a faster lookup time because they are cached by the interpreter. They are defined using colons like :symbol_name. Variables, on the other hand, are declared using variables names such as variable_name and can hold any value.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to open a file in Ruby?
What function converts all html special symbols to html entities in ruby?
what is the difference between a gem and a plugin in Ruby?
What is ruby class?
What is rvm?
Difference between nil and false in ruby?
In how many ways you can compare Ruby string?
Explain about ruby code blocks?
Tell us the types of variables available in ruby class?
what is Interpolation in Ruby?
Tell me how symbol is different from variables?
Which ruby interpreter option enables debugging?