Hey, NB. Here's a little explanation I whipped up for someone we all know and adore here at SUO a while back that wasn't shared publically that explains arrays a bit. Hopefully it'll give you a little context since I compare a classical programming language with how to do the same thing in EUO.
-----------------------------------------------------------------------------
OK, well if you'd like to think about arrays here's something to think about.
First of all, perhaps a little bit about what arrays are.
Classically, arrays are a method of storing information so that the information can be addressed by indexing it. So for example (psudocode):
set Members[0] = "TrailMyx";
set Members[1] = "Cerveza";
set Members[2] = "Khameleon";
set Members[3] = "12X";
So after this, you could address all the members names by using an index within the array such as:
for (int i=0; i<=3; i++)
{
print("The member name is ",Members[i]);
}
But sometimes it's nice to be able to hold specific information about each member, and still be able to index it. Again classically, you might think about 2-dimensional arrays, or:
set Members[0][0] = "TrailMyx";
set Members[0][1] = "San Diego";
set Members[0][2] = "41";
set Members[1][0] = "Cerveza";
set Members[1][1] = "Back East";
set Members[1][2] = "Unk";
for (int i=0; i<=1; i++)
{
print("Member ",Members[i][0]," lives in ",Members[i][1], " and is ", Members[i][2], " years old."
}
However, you see how numerical indicies are not very descriptive. But this is the gist of arrays. You can have 1D, 2D, 3D, nD arrays. It really just depends on how you want to store your information.
So when people talk about "arrays" in EUO, they automatically CAN'T talk about arrays in the classical sense because there is no language construct for it. However, by using creative use of the concatenation, and even more creative use of namespaces, you can form a data structure that functions EXACTLY the same as an array.
From the first example (now in EUO)
set %Members_0 TrailMyx
set %Members_1 Cerveza
set %Members_2 Khameleon
set %Members_3 12X
for %i 0 3
{
display The member name is , #SPC , %Members_ . %i
}
stop
And the second example in EUO is:
set %Members_0_0 TrailMyx
set %Members_0_1 San , #SPC , Diego
set %Members_0_2 41
set %Members_1_0 Cerveza
set %Members_1_1 Back , #SPC , East
set %Members_1_2 Unk
for %i 0 1
{
set %member_index Members_ , %i , _
set %name %member_index , 0 ; compute the variable name, I.E. Members_0_0
set %location %member_index , 1 ; compute the variable name, I.E. Members_0_1
set %age %member_index , 2 ; compute the variable name, I.E. Members_0_2
set %name % . %name ; now get the value at %Members_0_0
set %location % . %location ; now get the value at %Members_0_1
set %age % . %age ; now get the value at %Members_0_2
display ok Member , #SPC , %name , #SPC , lives , #SPC , in , #SPC , %location , #SPC , and , #SPC , is , #SPC , %age
}
stop
If you'd like to see how to do this with namespaces and so that it makes more sense, lemme know. I'll save the namespaces for another day.