[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.2.7 Function Definitions

A function is a name for a particular sequence of statements. The syntax for the function definition is:

 
name
begin
  …
end

where name is function name and ‘’ represent a non-empty list of valid radtest statements.

Notice that newline characters are obligatory after name, begin and before the final end keyword.

If the function accepts arguments, these can be referenced in the function body using $n notation (see section Positional Parameters). To return the value from the function return statement is used.

For example, here is a function that computes sum of the squares of its two arguments:

 
hypo
begin
        return $1*$1 + $2*$2
end

This document was generated by Sergey Poznyakoff on December, 6 2008 using texi2html 1.78.