InterviewSolution
| 1. |
What Is The Difference Between Symbol And String ? |
|
Answer» The symbol in Ruby on rails act the same way as the string but the difference is in their behaviors that are opposite to each other. The difference remains in the object_id, memory and process TIME for both of them when used together at one time. Strings are considered as mutable objects. Whereas, symbols, belongs to the category ofimmutable. -String objects are written like
Symbols are used to show the VALUES for the ACTIONS like equality or non-equality to test the symbols faster then the string values. The symbol in Ruby on rails act the same way as the string but the difference is in their behaviors that are opposite to each other. The difference remains in the object_id, memory and process time for both of them when used together at one time. Strings are considered as mutable objects. Whereas, symbols, belongs to the category ofimmutable. -String objects are written like Symbols are used to show the values for the actions like equality or non-equality to test the symbols faster then the string values. |
|