[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Commenting out lines
From: |
John W. Eaton |
Subject: |
Re: Commenting out lines |
Date: |
Tue, 3 Aug 2004 11:20:28 -0400 |
On 3-Aug-2004, Przemek Klosowski <address@hidden> wrote:
| If there is I've missed it. I find it a real pain to have to put a
| "#" in front of each of a bunch of lines whenever I want to test an
| alternative method.
|
|
| Would it work for you to do
|
| if(pi==4)
| ... lines of code to be skipped
| endif
|
| Even better, you could
|
| if(method==3)
| ... code for method 3
| else if(method==4)
| ... code for method 4
| endif; endif
This works well most of the time and is the recommended solution (if
you don't want to use the comment-region method in Emacs). The
disadvantage of the "if (false) ... endif" method is that the text
between the "if (false)" and "endif" must be valid Octave code.
The latest release of Matlab also introduced a block comment:
%{
...
%}
My understanding of the rules for this type of comment block is that
the %{ and %} tokens must begin in column 1 (so a "%}" token that
does not begin in column 1 is not recognized as an end comment
region token)
the blocks may be nested (so the begin and end comment region tokens
must be balanced)
any text (not just valid code) may appear between the begin and end
comment region tokens
The first restriction is unfortunate and I'm not sure I understand the
reason for it -- what conflict would arise without this restriction?
The unfortunate part is that it prevents you from doing useful things
like commenting out the middle of some line as you can with the
"/* ... */" comments in C.
In any case, I'm sure that eventually we will see messages here from
people wondering why Octave is so backward as to not implement this
essential feature.
jwe
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Re: Commenting out lines, (continued)
- Re: Commenting out lines, Christoph Dalitz, 2004/08/03
- Re: Commenting out lines, Jonathan Stickel, 2004/08/03
- Re: Commenting out lines, Geraint Paul Bevan, 2004/08/03
- Re: Commenting out lines, Jonathan Stickel, 2004/08/03
- Re: Commenting out lines, Vic Norton, 2004/08/03
- Re: Commenting out lines, Christoph Dalitz, 2004/08/04
- Re: Commenting out lines, Christoph Dalitz, 2004/08/04
Re: Commenting out lines,
John W. Eaton <=