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

hello friends.. when i deployment my project in the client machine that is successful but whenever i try to run my project using .exe file then it gives me error "<filename>.exe is not a valid win32 application." what i do somebody halp me pls

1 Answers  


What is the difference between compiler and interpreter?

0 Answers  


What is the difference between Namespace and Assembly?

0 Answers  


What is a static class?

0 Answers  


Explain about Visual basic.NET culture?

0 Answers  






How to create a constant in vb.net?

0 Answers  


What is globalization?

0 Answers  


what are the types of threading models in VB.net ?

1 Answers   Satyam,


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

0 Answers  


what r the properties should be given to set method?

2 Answers   PSI Data Systems,


What is the relation between Garbage collector and finalize and destructor?

2 Answers   Kanbay,


What are Major Feature of VB.NET Over C#.NET

9 Answers   Wipro,


Categories