Difference between a sub and a function?

Answer Posted / m.sivakumar

A Sub Procedure is a method will not return a value
A sub procedure will be defined with a Sub keyword
Sub ShowName(ByVal myName As String)
Console.WriteLine (My name is: & myName)
End Sub

A function is a method that will return value(s).
A function will be defined with a Function keyword
Function FindSum(ByVal num1 As Integer, ByVal num2 As Integer)
As Integer
Dim sum As Integer = num1 + num2
Return sum
End Function

Is This Answer Correct ?    21 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the difference between dispose(), close(), exit(), end()? When do we use them?

546


What is datatype conversion?

552


Is vb.net dead?

536


What is the difference between c# and vb.net?

574


how many server control present in .net

2301






What are the types of generations in garbage collector?

538


Why do we use ansi keyword?

578


What is the class that allows an element to be accessed using unique key?

553


Explain about Visual basic.NET culture?

602


What do you understand by vb.net?

618


Explain i.tostring method?

530


i have two class that contain's two methods as same name in derived class i have to call these two methods what will happen at run time ?

2246


Explain the difference between vb.net and c#, related to oops concepts?

506


Is it necessary to have SQL server installed in your computer in order to create a service based database in vb.net?

1872


What are all the parts of .net framework?

531