Function Definition

Syntax                  [ | Private | Public | Friend ] _
[ Default ] _
Function name[type][([param[, ...]])] _
    [As type[()]] [Handles var.eventname]
    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.

Handles                The Function provides an event handler for the WithEvents variable's (var) event (eventname).

See Also               Declare, Property, Sub, WithEvents.

Example               '#Language "WWB.NET"
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
EndSub