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

What are the uses of vb script?

0 Answers  


What is Querystring collection?

0 Answers  


WHAT IS ENVIRONMENT VARIABLES?and where it is used in real time scenario?

2 Answers  


How to pass the parameter from one function to another function in VB Scripting?

1 Answers   Fastenal,


I want to count the total no of links present in yahoo home page. The script like Set fileSysObject=createobject("Scripting.FileSystemObject") Set linksFileName=fileSysObject.opentextfile("D:\samplelinkfile.txt",2,true) Set linkDescObj=description.Create linkDescObj("micclass").value="Link" Set noOfLinks=browser("yahoo").Page("Yahoo!India").ChildObjects(linkDescObj) For i=0 to noOfLinks.count-1 linkName=noOfLinks(i).getROProperty("name") linksFileName.writeline(linkName) Next linksFileName.close Set fileSysObject=nothing But while running the script it is fail (the object not present in the object repository).How to overcome please tell me the detail steps...for QTP9.30

1 Answers  






write a program to display configuration of a local system with the help of vb script.

0 Answers  


write any ttest cases using check points and parameterization

0 Answers  


How to get the background color of a weblist?

3 Answers   Accenture,


what is the object hyrarchy in QTP for a web based application

0 Answers  


How to write VB script for login module?

0 Answers  


Write a code to print numbers from 5 to 0?

0 Answers  


How are arrays declared in the vbscript language?

0 Answers  


Categories