Page 1 of 1

How to create an array?

Posted: Mon Jul 09, 2001 12:54 am
by ziplux
How can I create an array in a LOOP? Basically, I have a list of values I want to add one at a time to evaluate later. I don't see any way to create an array of values, except manually (<$blah = "blah" "blah2" "blah3">) and I can't LOOP on an empty variable because it won't work. Thanks in advance.

How to create an array?

Posted: Mon Jul 09, 2001 7:33 am
by John
You can create lists manually as you indicated, or you can append to them: <$blah=$blah "NewBlah">. Where is the list of values coming from? It is usually possible to create the variable directly with the list of values.

How to create an array?

Posted: Mon Jul 09, 2001 8:01 am
by bart
Try this:

<$a= a b c d e f g h i j k l>
<$b=>
<loop $a>
<$b=$b $a>
</loop>

b will contain all of a's members

How to create an array?

Posted: Mon Jul 09, 2001 12:40 pm
by ziplux
Thanks John, I didn't realize you could do that. That solves my problem.