D.4 Old-Style Function Declarations

For compatibility with previous versions, mailfromd also supports the legacy format of function declarations:

 
func name (param-types) returns rettype

Here, param-types is a comma-separated list of parameter types. The following abbreviations can be used: ‘s’ for string and ‘n’ for numeric. The same holds true for rettype as well.

The parameters declared this way are called positional parameters. The function can access its actual arguments using the notation $n, where n is the ordinal number of the argument(26). Arguments are counted from left to right. The first argument is $1.

For example, here's the definition of the ‘sam’ function (see sum–example), using the legacy syntax:

 
func sum(n, n) returns n
do
  return $1 + $2
done

Footnotes

(26)

Well, to tell you the truth, you can access named arguments using positional notation as well. But such a mixing of styles is not recommended.