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



hai..friends ....what is the difference between function and sub procedure ....here every one know&..

Answer / 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

More VB Script Interview Questions

print the array values in ascending order?

2 Answers   CSS Corp,


when you use For Loop, While..do, do..while? at what situations which loop will use.

1 Answers  


in qtp we ve datatable look like excel ,if we want to extract data from excel which saved in my documet how can i get that in datatable using vb script

2 Answers  


What are the differences between Visual Basic, VBA and VBScript? When would it be appropriate to use one as opposed to another?

1 Answers   Infosys,


Explain about vb script?

0 Answers  






why do u choose to go for testing why cant for devoloping

0 Answers  


Create a file system object to do the following i. Create a folder ii. Create a text file in the folder iii. Update text file with some tex

2 Answers  


a function that takes an integer array as an argument and returns the largest value in the array. Use the function in a program

1 Answers  


How to open browser in vb script?

0 Answers  


how to write code: to check whether the window of an Application Under Test exist or not . plz give with example

2 Answers  


where can i learn VB scripint ?

0 Answers   Satyam,


write a vbscript for finding the sum of the numbers from 1- 50

3 Answers  


Categories