19-Functions

0
429

This Visual Basic Tutorial is all about Functions. A procedure is a method that performs a task when it’s called. There are two types of procedures in VB.Net and they are:

Functionsreturn a value

Sub procedures or Subsdo not return a value

What is a Function? The Function statement is composed of the name, parameter and the body of a function.

This is the syntax  in performing the Function statement:

[Modifiers] Function FunctionName [(ParameterList)] As ReturnType

Statements…….
End Function

Where,

Modifiers: it specifies the access level of the function and its values are:

Public, Private, Protected, Friend, Protected Friend, and information concerning overriding overloading, shadowing and sharing.

FunctionName: point out the name of the function

ParameterList: identifies the list of the parameters

ReturnType: identifies the data type of the variable the function returns

Example:

Step 1: Create a function called Compute. This function will simply compute the value provided by the user.

 

Step 2: Call the function and Provide values.

 

Readers might read also:

 

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.