Comment multiple lines in ruby

A multi-line comment begins with the =begin token and ends with the =end token. These tokens should start at the beginning of the line and be the only thing on the line. Anything between these two tokens is ignored by the Ruby interpreter.

=begin
Between =begin and =end, any number
of lines may be written. All of these
lines are ignored by the Ruby interpreter.
=end

puts “Hello world!”

I’ve found that if I include a tab before =begin or =end, the comments don’t work. The =begin and =end each need to be written at the beginning of each line.

Permanent link to this article: https://blog.openshell.in/2011/03/comment-multiple-lines-in-ruby/

Leave a Reply

Your email address will not be published.