Commenting code

Here’s one stupid question:

How do you comment out a block of ruby code?

I know that “#” comments one line, but how do i comment out a block of
7-8 lines of code? Don’t seem to be able to find this anywhere.

Thanks,

Gabor

On Jun 6, 2007, at 2:10 PM, gabordemeter wrote:

Here’s one stupid question:

How do you comment out a block of ruby code?

I know that “#” comments one line, but how do i comment out a block of
7-8 lines of code? Don’t seem to be able to find this anywhere.

There is no block comment, but some editors support easy multi-line
commenting
In TextMate, for instance, it’s the menu item
Bundles>Source>Comment Selection.

There is block commenting:

=begin
stuff to get commented
=end

The tokens have to be flush to the left.

Jason

Sweet!

I just tried in SciTE and for it, it appears the ‘begin’ is opional but
the
‘end’ is required.

=
stuff to get commented
=end

Thanks Jason!

Thanks Jason! Really useful to know this.

Best,

Gabor

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs