GNU Octave Manual Version 3 by John W. Eaton, David Bateman, Søren Hauberg Paperback (6"x9"), 568 pages ISBN 095461206X RRP £24.95 ($39.95) |
33.9 Tips on Writing Comments
Here are the conventions to follow when writing comments.
- ‘#’
-
Comments that start with a single sharp-sign, ‘#’, should all be
aligned to the same column on the right of the source code. Such
comments usually explain how the code on the same line does its job. In
the Emacs mode for Octave, the M-; (
indent-for-comment
) command automatically inserts such a ‘#’ in the right place, or aligns such a comment if it is already present. - ‘##’
- Comments that start with a double sharp-sign, ‘##’, should be aligned to the same level of indentation as the code. Such comments usually describe the purpose of the following lines or the state of the program at that point.
The indentation commands of the Octave mode in Emacs, such as M-;
(indent-for-comment
) and TAB (octave-indent-line
)
automatically indent comments according to these conventions,
depending on the number of semicolons. See section `Manipulating Comments' in The GNU Emacs Manual.
ISBN 095461206X | GNU Octave Manual Version 3 | See the print edition |