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

Which object is used to work with the database in the vbscript language and what statement is used to create this object?

503


Explain different types of segment?

565


How can the spaces from the string be removed?

589


Mention how to assign a date value to a variable?

585


What purpose does ‘on error resume next’ serves?

545






What are the different types of loops available in the vbscript language?

527


How are comments handled in the vbscript language?

508


Mention what is the use of option explicit in vbscript?

545


Which loop is used in case of arrays in the vbscript language?

520


How will you convert a given number to long in vbscript?

490


Anyone have qtp11.0 crack?

2380


A folder is there inside no of textfiles are avilable. How do count the textfiles. Normally folder means we are using subfolder methods but textfiles is not working for subfolder methods and how do get file name also.

1506


who will create the object?

1720


What's the difference between vbscript and vb.net?

550


Hellow friends, I am learning QTP,but here problem is VB script. please guide me how to learn VB script w.r.t QTP and if you know any books tell me or if you have any materials or any use full material or any else w.r.t QTP please post me p.p.sekhar

1961