Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 3e60ff9d4d6f58c8fbd17208f14089fa > files > 107

octave-doc-3.2.3-3mdv2010.0.i586.rpm

<html lang="en">
<head>
<title>Comment Tips - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Tips-and-Standards.html#Tips-and-Standards" title="Tips and Standards">
<link rel="prev" href="Coding-Tips.html#Coding-Tips" title="Coding Tips">
<link rel="next" href="Function-Headers.html#Function-Headers" title="Function Headers">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Comment-Tips"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Function-Headers.html#Function-Headers">Function Headers</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Coding-Tips.html#Coding-Tips">Coding Tips</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Tips-and-Standards.html#Tips-and-Standards">Tips and Standards</a>
<hr>
</div>

<h3 class="section">C.3 Tips on Writing Comments</h3>

<p>Here are the conventions to follow when writing comments.

     <dl>
<dt>&lsquo;<samp><span class="samp">#</span></samp>&rsquo;<dd>Comments that start with a single sharp-sign, &lsquo;<samp><span class="samp">#</span></samp>&rsquo;, 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 <kbd>M-;</kbd> (<code>indent-for-comment</code>)
command automatically inserts such a &lsquo;<samp><span class="samp">#</span></samp>&rsquo; in the right place, or
aligns such a comment if it is already present.

     <br><dt>&lsquo;<samp><span class="samp">##</span></samp>&rsquo;<dd>Comments that start with a double sharp-sign, &lsquo;<samp><span class="samp">##</span></samp>&rsquo;, 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. 
</dl>

<p class="noindent">The indentation commands of the Octave mode in Emacs, such as <kbd>M-;</kbd>
(<code>indent-for-comment</code>) and <kbd>TAB</kbd> (<code>octave-indent-line</code>)
automatically indent comments according to these conventions,
depending on the number of semicolons.  See <a href="../emacs/Comments.html#Comments">Manipulating Comments</a>.

   </body></html>