Pages

Monday, November 23, 2015

Difference between sub-procedure and function

Functions or Sub Procedures ?

In programming languages Functions and Procedure are the code segments written separately to take advantage of reusability. If you want write the same code segments many places in the programming file, it is likely that your program would benefit from Functions or Procedures , rather than duplicating code segments in multiple places.
Functions returning values after processing are called Functions and functions returning no value are called Sub Procedures. The Sub procedure performs a task and then returns control to the calling code, but it does not return a value to the calling code.
function sample
functions
Sub Procedure sample



Private Sub add(ByVal a As Integer, ByVal b As Integer) Dim result As Integer result = a + b MsgBox("Result is " & result) //here Sub do not return the result End Sub

No comments:

Post a Comment