Syntax 

[ | Private | Public ] _

[ 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 

Public is assumed if access is omitted.


See Also 

Declare, Property, Sub


Example

Function Power(X,Y)

    P = 1

    For I = 1 To Y

        P = P*X

    Next I

    Power = P

End Function

 

Sub Main

    Debug.Print Power(2,8) ' 256

End Sub