Discussion:
Arrays
(too old to reply)
Marc
2008-06-16 03:48:28 UTC
Permalink
We can declare an array by using DIMENSION.
DIMENSION Array1[5]
But the problem is if I want to enter a 6th element to the array it gives an
error, because the array length is 5.
If I dont know the array length then I cant pass values to the array. Is
there any way to increase the array length when I entering values.
Stefan Wuebbe
2008-06-16 14:00:09 UTC
Permalink
Post by Marc
We can declare an array by using DIMENSION.
DIMENSION Array1[5]
But the problem is if I want to enter a 6th element to the array it gives an
error, because the array length is 5.
If I dont know the array length then I cant pass values to the array.
You can use ALen() to measure it.
Post by Marc
Is there any way to increase the array length when I entering values.
In FoxPro you can (re)Dimension arrays:

DIMENSION laTemp[1]
laTemp[1] = "one"
DIMENSION laTemp[3]
? laTemp[1] && still same content




hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
tom knauf
2008-06-17 10:06:22 UTC
Permalink
Hi,

you can redimension an array by caling dimension again.
to get the diemsnion of an existing array use alen, have a look to the
second parameter.
So its
dimension acarray[5]
dimension acarray[alen(acarray,1) +1 ] && redims to 6

hth
tom
Post by Marc
We can declare an array by using DIMENSION.
DIMENSION Array1[5]
But the problem is if I want to enter a 6th element to the array it gives
an error, because the array length is 5.
If I dont know the array length then I cant pass values to the array. Is
there any way to increase the array length when I entering values.
Loading...