Jump to content

Rebol Programming/Design Guide/Embed your documentation

From Wikibooks, open books for an open world

Keep your documentation in sync with your code by embedding documentation in your code.

Rebol was designed with this principle in mind.

Function argument blocks can be used to explain the purpose of the function, its arguments, and refinements.

HELP will automatically use this information.

Example:

days-in-month: func [
{Returns number of days in a month}
month [ word!]
{Month of the year}
] [
 
 days: [
  January 31 February 28 March 31 
  April 30 May 31 June 30 
  July 31 August 31 September 30 
  October 31 November 30 December 31
 ]
  days/month
]


>>  help days-in-month
USAGE:
   DAYS-IN-MONTH month
DESCRIPTION:
    Returns number of days in a month
    DAYS-IN-MONTH is a function value.
ARGUMENTS:
    month -- Month of the year (Type: word)