variables in an array
Kenneth Brody
kenbrody at spamcop.net
Tue Apr 30 14:45:00 PDT 2013
On 4/30/2013 10:58 AM, tob at b-e-s-t.com wrote:
>
> Is there a way to loop through an array using variables?
The subscript of an array is an expression, which can be a simple variable
if you need.
> or at least a way around it other than doing writes to another file?
>
> dim adz(100)(5,*)
> dim ct(3,.0)="0"
That is a syntax error. The "DIM" keyword is only for declaring arrays, not
variables.
ct(3,.0) = "0"
> loop1:ct=ct+"1"
> :ct GE "100":return
> :adz(ct)=ady("1"):adz(ct)="Y"
> goto loop1
I see nothing wrong with this code snippet (aside from the aforementioned
syntax error). It will go through the first 99 elements of the "adz[]"
array, and for any that is equal to the first element of the "ady[]" array
(which you don't show here), it will be set to "Y".
> I am new to this group and I apologize if this has been recently been
> discussed. But I don't see where fp will allow a variable in an array?
Perhaps if you explain what, exactly, you are trying to do, and what you
mean by "allow a variable in an array", we can help you better.
--
Kenneth Brody
More information about the Filepro-list
mailing list