[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Can ruby comment out a block of code???

Roseanne Zhang

10/14/2006 5:48:00 PM

It sounds pretty stupid, but I could not find a way to do it in Ruby
yet.

Such in C/C++/Java:
/*
This is all comments.

This forum is connected to a mailing list that is read by thousands of
people. Before you post, please use the FAQ, the Ruby documentation and
Google to find an answer to your question. If you can't find an answer
there, make sure to include all relevant information that is necessary
to help you in your post.
*/

Am I missing something???

Help, please!

--
Posted via http://www.ruby-....

5 Answers

James Gray

10/14/2006 5:54:00 PM

0

On Oct 14, 2006, at 12:47 PM, Roseanne Zhang wrote:

> It sounds pretty stupid, but I could not find a way to do it in Ruby
> yet.
>
> Such in C/C++/Java:
> /*
> This is all comments.
>
> This forum is connected to a mailing list that is read by
> thousands of
> people. Before you post, please use the FAQ, the Ruby documentation
> and
> Google to find an answer to your question. If you can't find an answer
> there, make sure to include all relevant information that is necessary
> to help you in your post.
> */

Ruby's block comment looks like this:

=begin

We're in a comment here. Both the =begin and the =end must be the
first elements on a line for this to work.

=end

James Edward Gray II

M. Edward (Ed) Borasky

10/14/2006 6:05:00 PM

0

Roseanne Zhang wrote:
> It sounds pretty stupid, but I could not find a way to do it in Ruby
> yet.
>
> Such in C/C++/Java:
> /*
> This is all comments.
>
> This forum is connected to a mailing list that is read by thousands of
> people. Before you post, please use the FAQ, the Ruby documentation and
> Google to find an answer to your question. If you can't find an answer
> there, make sure to include all relevant information that is necessary
> to help you in your post.
> */
>
> Am I missing something???
>
> Help, please!
>
<do this>

$ acroread Programming\ Ruby.pdf

Search for =begin

Page 218:
</do this>

Looks like a line starting with "=begin" and a line starting with "=end"
will comment out a chunk of code.

HTH





Roseanne Zhang

10/14/2006 6:53:00 PM

0

James Gray wrote:
> On Oct 14, 2006, at 12:47 PM, Roseanne Zhang wrote:

> =begin
>
> We're in a comment here. Both the =begin and the =end must be the
> first elements on a line for this to work.
>
> =end
>
> James Edward Gray II

Huge Thanks!

I believe I saw it once somewhere, but remembered it wrong.
I wrote
==begin
==end

and it dit not work. :(

Stupid me!!!!


--
Posted via http://www.ruby-....

Esad Hajdarevic

10/15/2006 1:57:00 PM

0

James Edward Gray II wrote:

> Ruby's block comment looks like this:
>
> =begin
>
> We're in a comment here. Both the =begin and the =end must be the first
> elements on a line for this to work.
>
> =end

Are there any plans on introducing shorter form in ruby 2?

The form isn't that much of a problem, but the fact that something like
that isn't possible

puts "hey" =begin
comment
=end

Esad

David Vallner

10/15/2006 4:12:00 PM

0

Esad Hajdarevic wrote:
> Are there any plans on introducing shorter form in ruby 2?
>

Using all pound signs is more common - I only see the =begin / =end
style for file headers. Just Learn To Use Your IDE/Editor, and use
whicheverkeycombo it provides for line-commenting a paragraph, and
letting you span such a comment over multiple lines easily. I -think-
ruby-mode for Emacs supports auto-fill for that. Might be thinking of
another language though.

David Vallner