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 is a literal control?

0 Answers  


What are the shadow variables?

0 Answers  


what is vb.net

1 Answers   TCS,


when do we need a multiple document interface?

2 Answers  


What is the DIfference between Friend and Protected Friend?

6 Answers   CTS, Sykes Enterprises, TCS,






difference between checkbox vs radiobutton??

0 Answers  


What is datatype conversion?

0 Answers  


When do you use virutal keyword?

0 Answers  


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,


Explain the difference between .dll extension and .exe extension files?

0 Answers  


what is the base class of .net?

7 Answers  


What is redim keyword and its use?

0 Answers  


Categories