Commenting code in Ruby

There's two ways to comment code in Ruby. Single lines that commence with a hash (#) are comments, or you can use block commenting:

=begin
This is all commented out.
It spans multiple lines, until we end it.
=end

Every few months I need to comment a big block of code and I always forget how to do it :)

3 Comments so far

  1. Hale on July 1st, 2008

    In Perl, you can use =for and =cut to do the same thing. I forget how to do it all the time as well.

  2. Adam on July 2nd, 2008

    This is my most favourite post from you this month.

  3. mlambie on July 2nd, 2008

    Awesome Fitzy. I think so too.

Leave a Reply