(octave.info)Comments and the Help System


Prev: Block Comments Up: Comments
Enter node , (file) or (file)node

2.7.3 Comments and the Help System
----------------------------------

The ‘help’ command (Note: Getting Help) is able to find the first
block of comments in a function and return those as a documentation
string.  This means that the same commands used to get help on built-in
functions are available for properly formatted user-defined functions.
For example, after defining the function ‘f’ below,

     function xdot = f (x, t)

     # usage: f (x, t)
     #
     # This function defines the right-hand
     # side functions for a set of nonlinear
     # differential equations.

       r = 0.25;
       ...
     endfunction

the command ‘help f’ produces the output

      usage: f (x, t)

      This function defines the right-hand
      side functions for a set of nonlinear
      differential equations.

   Although it is possible to put comment lines into keyboard-composed,
throw-away Octave programs, it usually isn’t very useful because the
purpose of a comment is to help you or another person understand the
program at a later time.

   The ‘help’ parser currently only recognizes single line comments
(Note: Single Line Comments) and not block comments for the initial
help text.


automatically generated by info2www version 1.2.2.9