Difference between a sub and a function?

Answer Posted / satishdubey

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 ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is interface and when it is used?

1826


What are the types of generations in garbage collector?

528


Explain about Visual basic.NET culture?

587


Which namespace are used for accessing the data?

638


I Am Developing A project where I can send Message from One Computer to Another Computer With The Help Of LAN.Already I Have developed..It is working Fine With The Details Of ..TO,FROM,REF No,DATE,BODY...Now I Want To Add Attachments part in the same projects...How Can I Send Attachment File & How To Send It..I Am Working in VB.Net 2005 With out Any database. Can Any One Help me ??How To Write Code??Plz Send me a copy to my Mail also...I Dont Need Any Software Available in The Internet...Plz refer me The Code in VB.Net maloy.adhikari@in.com

2206






Observations between vb.net and vc#.net?

565


What is an application domain? how they get created?

577


Sir, what code to store data from vb net sql server 2008 to 2005 and at the same time in order to validate the data entered is not the same, but there have been contacts in the module. Examples such as the log table that I created, the user name as the primary key.

1742


Name and explain some of the exclusive features which are present in vb?

544


What is multiple form in vb?

451


what is commom language runtime?

548


Explain the use of console application?

526


What are the advantages of an assembly?

594


Explain the difference between web.config and machine.config and where it will be ?

494


Explain the difference between value and reference types?

449