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

Explain i.tostring method?

0 Answers  


Explain an assembly?

0 Answers  


What are the features present in vb 2005?

0 Answers  


Explain the use of option explicit?

0 Answers  


What are the differences between server-side and client-side code?

0 Answers  


What does assert() method do In VB.NET

0 Answers   MCN Solutions,


i have two class that contain's two methods as same name in derived class i have to call these two methods what will happen at run time ?

0 Answers   IBM,


What is CLR?

20 Answers   Horizon Computers, Microsoft,


Explain the difference between dispose and finalize()?

0 Answers  


code for export,import,save,update,delete ?

1 Answers  


Is VB.NET object oriented? What are the inheritances does VB.NET support ?

13 Answers   Digital GlobalSoft, Global Infotech, Infosys,


is it possible to use flexgrid in vb dotnet?

9 Answers   Banking, Microsoft, NetBIOS,


Categories