How can we return a value from User Defined Function ?
For Eg. we have 2 functions. In Fun1 i am getting 2 values
(a,b) and i am addding those 2 and storing in to another var
(c). Now i want to pass that var(c) to another function
(fun2). What will be the script?

Answer Posted / siri

'vbscript
'create two functions
dim a,b,d
a=20,b=30
dim c
d=add(a,b)
msgbox d
call subtract(d)

function add(a,b)
dim c
c=a+b
add=c 'add is the function name:this statetment can
return c value
end function

function subtract(c)
dim f,e
f=20
e=d-c
msgbox e
End function

Is This Answer Correct ?    6 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

give me any information abou vb script books learn quckly

1657


What is the scope of a constant declared using public?

551


Can someone please tell me what poor design in a relational database (not the layout or style) is and how it can be avoided? PLEASE...im desperate.

1409


Which function allows you to instantiate an object given its programmatic identifier or progid?

555


If else for do while select in vb script?

636






Which operator is used for fetching the modulus of the 2 numbers in the vbscript language?

545


what is the use of QCUtil? explain with one example?

6317


What are the data types supported by vbscript?

576


How strcomp function works?

621


What are the special sub-types in vbscript?

546


What are the 2 ways in which a variable can be declared in the vbscript language?

562


Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?

3029


How will you get a subset of a array in vbscript?

583


what is diff between static and dynaic arrys?

1584


who will create the object?

1481