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


Please Help Members By Posting Answers For Below Questions

Difference between Class Module and Standard Module?

2073


Is there any Edit method in ADO Data Access method?

1609


What is the difference between Msgbox Statement and MsgboxQ function?

1530


what are the Types of cursors in RDO?

1954


which property used to add a menus at runtime?

1559






____ property is used to lock a textbox to enter a datas.

1274


Difference between ActiveX Control and Standard Control.

2216


How do I get the Tab key to be treated like a normal character?

1104


Scope of API's can be of types, what are they?

1589


How would you add elements and pictures to listitems in listview control?

1612


Is visual basic still used?

604


What is OLEDB?

1630


What are the types of line styles available in Treeview Control?

1977


How do I remove/change the picture property of a control at design time?

1190


What is data control in vb?

652