Function Definition

Syntax              [ | Private | Public | Friend ] _
[ Default ] _
Function name[type][([param[, ...]])] _
    [As type[()]]
    statements
End Function

Group                Declaration

Description       User defined function. The function defines a set of statements to be executed when it is called. The values of the calling arglist are assigned to the params.  Assigning to name[type] sets the value of the function result.

Access              If no access is specified then Public is assumed.

See Also            Declare, Property, Sub.

Example            '#Language "WWB-COM"
Function Power(X,Y)
    P = 1
    For I = 1 To Y
        P = P*X
    Next I
    Power = P
End Function

SubMain
    Debug.Print Power(2,8) ' 256
End Sub