hai..friends ....what is the difference between function and
sub procedure ....here every one know's theoretically here
my question is what is the meaning of function can return
the value and sub can't return the value...can you give one
example with some values for that ....what does it mean ?
how function can return the value...sub can not...any one
please...........with example

Answer Posted / monika

function myfunction(a,b)
myfunction=a+b
End function

returnvalue=myfunction(5,9)
msgbox returnvalue

it will display value returned by function and stored in returnvalue variable as 14

sub myfunction(a,b)
myfunction=a+b
End sub

returnvalue=myfunction(5,9)
msgbox returnvalue

it will throw error as no value returned by sub

sub myfunction(a,b)
c=a+b
msgbox c
End sub

call myfunction(5,9)

it will display 14 inside sub

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which operator is used to concatenate the 2 values in the vbscript language?

557


What is the difference between function and procedure?

573


Explain about tristate constants?

587


what is used of Property........End Property loop ? how to write the script for it?

1687


regular expression that will recognize a browser as long as its name property starts with mybrowser

1761






What is the difference between a dictionary and an array?

583


How are values assigned to string type and numeric type variables?

539


What is the use of the ‘open’ method to work with the database in the vbscript language and what connection string is passed in the same and what is its usage?

487


What is select case statement?

605


What is the extension of the vbscript file?

553


I have an excel sheet with multiple ID's in a column. Now i need fetch those ID's in an application and check whether if it already exist in the DB. If not then i have to go with the process of inserting them in the DB. If it exists then i need to skip that ID and move to the next ID and check the same and proceed. How can i do that with for loop and if condition?

862


What is the purpose of drive object of scripting.filesystemobject class in vbscript?

607


What is the main difference between function and sub-procedure?

550


What is the use of the date function in the vbscript language?

565


Hai this is sheik, i want to learn VB scripts for web application pls guide me what are all basic things need to know to learn VB scripts in web application.

1432