# Multidimensional Anonymous Arrays (Language Help)

Hi guys, I'm just starting out with BASIC256 and I'm hoping to teach it to a class of children soon. It's looking quite good so far but I've hit a small problem: is there any way to initialise a multidimensional array? Something like:

grid = { { 1, 2, 3, 1, 1 },
{ 2, 0, 2, 1, 0 },
{ 0, 1, 1, 2, 3 },
{ 3, 2, 1, 0, 0 },
{ 0, 1, 2, 0, 3 } }

I could possibly use one big one-dimensional array instead, or load the data from a file, but these are complications I was hoping to avoid at the moment.

Anyway, thanks for making this neat little language :)

## Multidimensional Anonymous Arrays

the dimension statement for a two dimensional array (for a 5x5 array called "grid" is just:

dim grid(5,5)

(remember that each array index for this case would go from 0 to 4 and not 1 to 5)

Hi guys, I'm just starting out with BASIC256 and I'm hoping to teach it to a class of children soon. It's looking quite good so far but I've hit a small problem: is there any way to initialise a multidimensional array? Something like:

grid = { { 1, 2, 3, 1, 1 },
{ 2, 0, 2, 1, 0 },
{ 0, 1, 1, 2, 3 },
{ 3, 2, 1, 0, 0 },
{ 0, 1, 2, 0, 3 } }

I could possibly use one big one-dimensional array instead, or load the data from a file, but these are complications I was hoping to avoid at the moment.

Anyway, thanks for making this neat little language :)

## Multidimensional Anonymous Arrays

You can initialize a two dimensional array using the curly braces as if it were a single dimension array. The columns are filled across the rows as you can see here.

dim a(3,4)
a = {1,2,3,4,5,6,7,8,9,10,11,12}
for r = 0 to 2
for c = 0 to 3
print a[r,c]+" ";
next c
print
next r

## Multidimensional Anonymous Arrays

Now why didn't I think of that? Thanks!

## Multidimensional Anonymous Arrays

that's a handy thing to know, thanks