Ruby : Writing Very long string in multiple lines

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"

 

Advertisements