Strings (Part 4)

Below is an example of a document that consists of lines in the source but without the terminating string that is needed after the “<<” character. This terminator must start in the first column but with the minus “-” sign after the “<<” character, indention can be done on that specific terminator\ as shown below.

print <<-STRING1, <<-STRING2
Con
STRING1
centrate
STRING2

Gives you

Con
centrate

In the next posts, we would discuss strings further for they are considered to be the largest Ruby class, with over 75 standard methods making it the most used data type in the whole of Ruby.

This entry was posted in Development, Programming Basics and tagged , . Bookmark the permalink. Comments are closed, but you can leave a trackback: Trackback URL.