W3cubDocs

/Octave

2.7.3 Comments and the Help System

The help command (see 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 (see Single Line Comments) and not block comments for the initial help text.

© 1996–2018 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/interpreter/Comments-and-the-Help-System.html