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()?

693


What are the types of generations in garbage collector?

731


Explain about the performance of visual basic?

801


Name the two main parts of .net?

705


Explain public assembly?

722


what is common language specification?

718


Described strong typing

741


Explain the components of common language runtime.

764


What is an assembly and its use?

741


Write program in VB.Net with SQL Server and Crystal Reports to develop a small windows application to add,edit,save, search and print Employee Information and send sourcecode as zip file. empcode : .............. empname : .............. dateofjoin : dd/mm/yyyy dateofbirth : dd/mm/yyyy TableName: EmpMaster EmpCode EmpName DOB DOJ TableName: EmpDocs EmpCode DocNo DocName ExpDate

2402


Define cls?

778


What is an arraylist?

804


What is a literal control?

744


What are the advantages of VB.NET?

758


Explain strong name in .net assembly?

736