[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: commenting
In article <3A92A095.EB03CCA4@cmb.physics.wisc.edu>,
Christopher W. O'Dell <odell@cmb.physics.wisc.edu> wrote:
>that is BEAUTIFUL. perfect. Now my repetitive motion injuries
>may begin the long healing process!
>
>Thanks,
>Chris
>
>David Fanning wrote:
>
>> Christopher W. O'Dell (odell@cmb.physics.wisc.edu) writes:
>>
>> > This is probably wishful thinking, but is there any way to
>> > comment out a large section of code as in C,
>> > where you don't have to insert a ';' on every line of code,
>> > but you can use a beginning and ending comment delimiter?
>> > I have this idea that there might be secret delimiters that
>> > i have not yet heard about in IDL. And I'm very lazy and
>> > have often longed for this feature.
>>
>> It's wishful thinking.
>>
>> But you can always temporarily wrap code you want to ignore
>> in an IF statement:
>>
>> ignore = 1
>> IF ignore NE 1 THEN BEGIN
>>
>> ... code to ignore here...
>>
>> ENDIF ; of code I am ignoring
>>
>> It's not elegant, but if the code you want to ignore
>> consists of a lot of lines, it cuts down on repetitive
>> motion injuries. And you can easily go back and forth
>> just by setting the ignore flag. :-)
Come on, David, it is bloody elegant! I stumbled across this
in the days of Fortran II, with a GO TO statement to boot. Now,
that was a lot less elegant!
And, if you use vi, here is something I do:
:l1,l2s/^./;&
where l1 and l2 are the line numbers delimiting the block of interest.
And, you undo it with
:l1,l2s/;//
Voila!
--
Surendar Jeyadev jeyadev@wrc.xerox.com