Difference between a sub and a function?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between import system.data.sqlclient,system.data.oledb?

757


What do you mean by Redim in VB.NET?

847


Explain jit?

726


What are all the differences between dispose and finalize()?

737


List the types of generations in garbage collector?

678


What is a preprocessor directive in vb.net?

731


What is code security?

700


What is an arraylist?

801


What is the differences between dataset.clone and dataset.copy?

832


What is the difference between convert.tostring and .tostring() method?

739


What is difference between metadata and manifest?

795


i am attending to US consulate i kept my projects on vb.net ,please help me what questions will be ask on vb.net in us consulate

2104


Why should you use delegate?

654


What is break mode? What are the options to step through code?

756


What is the importance of a Button control?

1075