One would have to think in Ruby. For a C programmer, it can be a hard 
transition but once one gets used to the Ruby way, you will find the C way 
bit inflexible and rigid. For example, in C, you might write:

#define NUM_COLS 20
#define NUM_ROWS 10
int ary[NUM_ROWS][NUM_COLS];
...
int i, j;
for (i = 0; i < NUM_ROWS; i++) {
    for (j = 0; i < NUM_COLS; j++) {
        ary[i][j] = some_code....
   }
}

In Ruby, you don't need to worry about setting up iterator variables since 
arrays know how to iterate themselves, e.g.

ary.each {|r|
    r.each {|c|
        ...
    }
}

If you need to access a specific element, you can still use the C-like 
notation, i.e. ary[r][c].


----- Original Message ----- 
From: "Chris Gehlker" <canyonrat / mac.com>


>
> On Aug 16, 2006, at 2:37 AM, marinho.tobolla / syncity.de wrote:
>
>> Well am I right, that in Ruby there are only one dimensional  arrays, and 
>> that i have to add an array into an array to get  multidimensional 
>> arrays, or is there a simpler more ruby like way  to create them ?
>
> Yep. You create them by just making arrays of arrays and you  reference 
> them just like C arrays
> irb(main):001:0> ary = []
> => []
> irb(main):002:0> ary << [1, 2, 3] << %w{dog cat bird} << [8, 10, 17]
> => [[1, 2, 3], ["dog", "cat", "bird"], [8, 10, 17]]
> irb(main):003:0> ary[1][2]
> => "bird"
>
>
> --
> The folly of mistaking a paradox for a discovery, a metaphor for a  proof, 
> a torrent of verbiage for a spring of capital truths, and  oneself for an 
> oracle, is inborn in us.
> -Paul Valery, poet and philosopher (1871-1945)
>
>
>
>
>