Comments

Many of the source code examples that come with this book are documented with comments that are ignored by the Ruby interpreter. You can place a comment after the hash mark (#). The text on a line following this character is all treated as a comment:

# this is a comment
puts( "hello" ) # this is also a comment

If you want to comment out multiple lines of text, you can place =begin at the start and =end at the end (both =begin and =end must be flush with the left margin):

=begin
 This is a
 multiline
 comment
=end

Get The Book of Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.