Multi-Line Comments in Ruby?

#!/usr/bin/env ruby

Every body mentioned this way
to have multiline comments.

The =begin and =end must be at the beginning of the line or
it will be a syntax error.

puts "Hello world!"

Also, you could create a docstring.

puts "Hello world!"

" kinda ugly and creates
a String instance, but I know one guy
with a Smalltalk background, who
does this."

puts "Hello world!"

# most
# people
# do
# this


But all forgot there is another option.
Only at the end of a file, of course.
  • This is how it looks (via screenshot) – otherwise it’s hard to interpret how the above comments will look. Click to Zoom-in:

Comments in a text-editor

Leave a Comment