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 is code access security?

676


Name the tool which can convert visual basic old version to .net compatibility version?

507


How can we remove handlers at run time?

531


Explain convert.tostring and i.tostring method?

519


what is the need for dynamic controls in vb.net? i would like to know for what purpose should we create the controls dynamically? please give the answer in simple words.

1954






Define naming convention?

616


Explain enumerator?

518


How do you retrieve the customized properties of a .net application from xml .config file?

510


Explain the difference between thread and process?

501


What is the significance of delegates?

510


Explain about the keyword must inherit?

572


Which class allows an element to be accessed using unique key?

513


What is an application domain? how they get created?

577


Explain an assembly?

565


What is difference between metadata and manifest?

559