Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning value to an array
Message
From
04/04/2000 23:01:09
 
 
To
04/04/2000 21:40:44
Ian Johnston
Computer Software Solutions
Woodland, California, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00355436
Message ID:
00355469
Views:
15
>What is the syntax for returning a value from an array in a function to an array and will it automatically dimension the array it is returning to ?

If you want to pass an array reference in, modify the array within a function, and have the results persist, you need to pass the array by reference:

DECLARE aSomeArray[4]
aSomeArray = 42
? ALEN(aSomeArray)
? MyFunc(@aSomeArray)
? ALEN(aSomeArray)
? aSomeArray(ALEN(aSomeArray))

FUNCTION MyFunc
LPARAMETER taPassedInArray
LOCAL nOldEntries
nOldEntries = ALEN(taPassedInArray)
DIMENSION taPassedInArray[nOldEntries+1]
taPassedInArray[1] = "I changed the old value"
taPassedInArray[nOldEntries+1] = "and added a new one"
RETURN taPassedInArray[1]
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform