Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning multiple values form a function
Message
From
03/05/2000 13:12:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/05/2000 13:03:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00365646
Message ID:
00365656
Views:
13
>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,
Probably you didn't pass by reference. There are other workarounds. Create custom form property such as aRetArray[1], pass also form's object ref to function so it fills directly your custom array.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform