Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning multiple values form a function
Message
From
03/05/2000 13:03:04
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Returning multiple values form a function
Miscellaneous
Thread ID:
00365646
Message ID:
00365646
Views:
59
Hi to all,

Is it possible to return many values from a function or a procedure. I tried to return an array which would contain all the values I need but it didn't work, I only got the last value.

The code I tried was something like this:

FUNCTION calculate(list of parameters)
bla bla bla
dimension taReturn(3)
taReturn[1] = lnvalue1
taReturn[2] = lnvalue2
taReturn[3] = lnvalue3

return taReturn

ENDFUNC

and in my form I did something like this:

declare taAnswer(3)

taAnswer = calculate(list of parameters)

wait windows str(taAnswer[1])
wait windows str(taAnswer[2])
wait windows str(taAnswer[3])

All 3 wait windows gave me the same value which is lnvalue3 from the function.


TIA
Diane Robitaille eng.
Next
Reply
Map
View

Click here to load this message in the networking platform