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

Explain option explicit?

647


Tell me which namespace are used for accessing the data?

595


Explain about the keyword must inherit?

655


Before in my vb app I would just load the icons from dll. How can I load the icons provided by .net dynamically?

599


Name the class which allows an element to be accessed using unique key?

638






How to run a dos command in vb.net?

685


Explain how to send xml file on server using http protocol?

573


Explain public assembly?

627


What is the role of new keyword?

707


What are the features present in vb 2005?

652


Explain convert.tostring and i.tostring method?

598


Explain cts?

623


What languages does the .net framework support?

618


Explain about the ruby interface generator?

639


what is difference between namespace and assembly?

631