Difference between a sub and a function?

Answers were Sorted based on User's Feedback



Difference between a sub and a function?..

Answer / 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

Difference between a sub and a function?..

Answer / 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

More VB.NET Interview Questions

What are the shared variables?

0 Answers  


What is non_deterministic finalization?

0 Answers  


How do you use two datareaders at the same time in a vb.net windows application ?

0 Answers  


what is commom language runtime?

0 Answers  


What is multiple form in vb?

0 Answers  






Why is the xml infoset specification different from the xml dom?

0 Answers  


how can we assigns items on listbox so that it will show rowwise please write the code for it.

3 Answers  


Explain strong name in .net assembly?

0 Answers  


What are the advantages of VB.NET?

0 Answers  


Which dll is used for microsoft .net run time?

0 Answers  


I want to reduce my CPU Usage when I am querying the Database for records. Now my Winform App(in VB.Net) suddenly Jumps to 100% CPU Usage when i query for records from sql server database. I want this Usage to be less. Any help is appreciated

2 Answers  


what is common type system?

0 Answers  


Categories