Function Statement

Defines a procedure that returns a value.

Syntax

Standard form
[ Shared ] Function name [ < typeList > ] [ parameterList ] [ returnType ]
    [ Where genericConstraints ]
    [ statements ]
End Function
Trait aliasing form
[ Shared ] Function name Does traitName . oldName

Parts

Shared
Optional; Specifies that the function is associated with its surrounding object and not an instance of that object.
name
Required identifier
typeList
Optional in the standard form. One or more identifiers separated by commas and enclosed in angle brackets. See Type List for details.
Not present in the aliasing form, even though the procedure may be generic.
parameterList
Optional in the standard form. Zero or more local variables, separated by commas, whose values are assigned when the function is called. See Parameter List for more information.
Not present in the aliasing form, even though the procedure may have parameters
returnType
Optional in the standard form.
Not present in the aliasing form, even though the procedure may have a return type.
Syntax:
As dataType
or
In unit
dataType
Describe
unit
Describe
genericConstraints
Optional. See Where Clause (Generics) for details.
statements
Optional in the standard form.
Not present in the aliasing form.
End Function
Terminates the Function block.
Not present in the aliasing form.
traitName
Required in the aliasing form, the name of a trait that the class or object imports.
oldName
Required in the aliasing form, the name of a method imported through traitName.

Remarks

Do not confuse the End Function clause with the Exit Function statement.

Examples

See also