Home / Visual Basic Tutorial / Procedure / Function Procedures

Function Procedures

Function Procedures return values. you can use Function statement to write your own Function procedures.

Like a Sub procedure, a Function procedure is a separate procedure that can take arguments, perform a series of statements, and change the value of its arguments.


[Private|Public][Static]Function procedurename (arguments) [As type] statements
End Function

Note that:

1.You call a function by including the function procedure name and arguments on the right side of a larger statement or expression (returnvalue = function()).

2.Function procedures have data types, just as variables. This determines the type of the return value.

3.You return a value by assigning it to the procedurename itself.


Public function Addition(a,b)
End Function

Here Function addition is declared .It takes two arguments and then add these two values. It returns sum of two values.