What is the difference between a Sub and a Function?
Answer Posted / mukesh
A function accepts any number of parameters (possibly
zero), does something with them, and returns a value.
A subroutine is performs an action, but doesn't return a
value.
There are two differences between a function and a
subroutine:
A)How they are invoked. B)How they are accessed.
A function call has the following syntax ::function (arg1,
arg2, ...)
where: function -->Is the name of the function. arg1,
arg2, ... Are the arguments.
A subroutine call has the following syntax ::subroutine
(arg1, arg2, ... {outputfield|'format'})
where: subroutine -->Is the name of the subroutine. arg1,
arg2, ... Are the arguments.
{outputfield|'format'} Is the name of the output field or
its format.
In addition, on some platforms, the functions are available
immediately; whereas, the subroutines are available in a
special subroutine library that you must access.
| Is This Answer Correct ? | 17 Yes | 4 No |
Post New Answer View All Answers
What are forms in visual basic?
Explain about an event-driven programming language?
How do I make my applications screen-resolution independent?
How to customize workgroup message?
Explain the "cursortype" and "Locktype" in VB?
How to use advanced data-bound controls.
What is OLEDB?
Is it possible to set a shortcut key for label?
What is form in visual basic?
What is ODBC Direct and Microsoft Jet Database Engine ?
What is Seek Method which type of record set is available this?
How to get freefile location in memory?
Through which protocol OLEDB components are interfaced?
How would you add column headers in listview control?
How would you create your application in DHTML?