How to return a value from function...?

you should not tell msgbox, print.. etc.,

Answer Posted / vgr

Dim StrFunVal
StrFunVal = fn_MyFunction(7)

Function fn_MyFunction(Num)
fn_MyFunction=Num+8
End Function

During the execution the "StrFunVal" variable will contain
the value 15. If you don't want to use 'Msgbox' or 'Print'
then declaring a variable is prefered.

For your other question I haven't come across returning
more than 1 value from functions. Probably we have to use a
ARRAY kind of stuff...but not sure. Need to work on it.

Cheers,
VGR

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention how to access array data?

713


How will you compare two strings in vbscript?

839


Write a function for Instr(). We need to write a function that works as same as Instr(). Code or Even pseudo code is good enough for me.?

2299


What are the data types supported by vbscript?

828


How to make professional test report using vbscript code in UFT, which gives us complete analysis of the test.

2746


Mention if qtp generates vbscript code as we record actions, can't it possible to directly write using vbscript code when qtp does the same thing too?

796


write any ttest cases using check points and parameterization

2054


Explain the operator precedence in vb script?

872


How to identify column in VSFlexgrid? My VSFlexgrid window is identified as 'Active X Control'

3537


what is diff between static and dynaic arrys?

1858


Compare java script and vb script?

867


Explain vbscript in detail?

843


How will you release the memory acquired by an array variable in vbscript?

1007


Mention what is select case statement?

762


When to use function procedures and what are its characteristics?

836