A parameter may be declared with a default value which is used if the caller does not provide a value for the argument.

    1. proc foo(a: int, b: int = 47): int

    Parameters can be declared mutable and so allow the proc to modify those arguments, by using the type modifier var.

    1. proc toLower(c: char): char = # toLower for characters
    2. if c in {'A'..'Z'}:
    3. result = c
    4. proc toLower(s: string): string = # toLower for strings
    5. result[i] = toLower(s[i]) # calls toLower for characters; no recursion!

    Calling a procedure can be done in many different ways:

    A procedure may call itself recursively.

    1. proc `$` (x: int): string =
    2. # converts an integer to a string; this is a prefix operator.

    Operators with one parameter are prefix operators, operators with two parameters are infix operators. (However, the parser distinguishes these from the operator’s position within an expression.) There is no way to declare postfix operators: all postfix operators are built-in and handled by the grammar explicitly.

    Any operator can be called like an ordinary proc with the ‘opr’ notation. (Thus an operator can have more than two parameters):