Using backward slash (\) at the end of line tells the ruby parser that the line is still incomplete. Also the parser concatenates the two string into one.
> long_sentence = "This is a very long sentence and this line even cannot"\
> " be written in one line"
=> "This is a very long sentence and this line even cannot be written in one line"
You might have notices or not but if you define a Hash instace with keys in ‘String’ then you cannot access then via :symbol and vice-versa
To be more clear see the following code snippet
No matter how they behave, Symbol and String in Ruby are alike. We can define Symbols as a type of String ( just according to behavior ). We often use them interchangeably in our code knowingly or unknowingly. Its has been said that Symbols are better than String however many of us are unaware about the core reasons. Continue reading
I stumbled upon this when I was trying store URL in a Hash’s key to use inside a loop. The text editor (IDE) warned me and I was shocked I did I do? Continue reading