Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to return a value from function...?

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

Answers were Sorted based on User's Feedback



How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / bfakruddin

in VB Script

Is This Answer Correct ?    3 Yes 1 No

How to return a value from function...? you should not tell msgbox, print.. etc.,..

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

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / rishi agrawal

Function MyFunction(Num)

InputBox("What is your name?","My Input")
'Code for return value from function
MyFunction= Num + 1

End Function

Is This Answer Correct ?    3 Yes 2 No

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / siba sankar nayak

In which language?
In C. C++, Java like language,
we can use "return" key word to returnd values from
functions.

Is This Answer Correct ?    1 Yes 1 No

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / bfakruddin

Function MyFunction(Num)

MyFunction=Num+1

End Function

Num=InputBox("Enter a Number")

call MyFunction(Num)
msgbox MyFunction 'It returns Num+1 value calculated in
Function

Just we have to use the Function Name to return a value...
and we can use that value out of that function...

One more question Can we return more than 1 value from
functions?


visit for qtp info http://qtptesters.wordpress.com

Is This Answer Correct ?    1 Yes 1 No

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / selva

yes function can return multiple vales.
Public Function fn()
Dim arr(1)
arr(0)=23
arr(1)=67
fn=arr
End Function
a=fn

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More VB Script Interview Questions

What is a class in CSS?

1 Answers  


What are the properties of regexp object?

0 Answers  


How to delete a cookie using vbscript?

0 Answers  


What is the difference between vbscript and vba?

0 Answers  


How regexp.execute method works?

0 Answers  


input values to accept 2 numbers & print the product, difference and sum using switch case

1 Answers   CSC,


When are redim statement and preserve keyword used in the vbscript language?

0 Answers  


Mention what is the technology used by vb script?

0 Answers  


Which in-built functions are used to convert the specified expression in the form of date and string in the vbscript language?

0 Answers  


What purpose does ‘on error resume next’ serves?

0 Answers  


How many types of procedures are available in the vbscript language?

0 Answers  


What is the differene between QTP 8.2 and QTP 9.0 and QTP 9.1,Pls give me answer ASAP.

3 Answers   Accenture,


Categories