Hi,

That's because you are mixing array and range, which are totally different
objects.  I think what you want is

$a = [[1,2,3],[4,5,6],[7,8,9]]
(0..2).each do |i|        # not brackets, but grouping parentheses
    (0..2).each do |j|    # not brackets, but grouping parentheses
        print $a[i][j]
    end
    print "\n"
end

0..2   # => a range
[0..2] # => an array with a single element of Range class

Regards,

Bill
=========================================================================
Rotfeast <rotfeast68 / hotmail.com> wrote:
> At the risk of sounding like a nuby to ruby...

> I know in Python, I can print the contents of the array
> [[1,2,3],[4,5,6],[7,8,9]] on the screen by using nested loops and "\n"
> statements.  I can make it appear as 3 rows of 3 elements, like a
> matrix.  I tried doing this in Ruby using analogous syntax:

> [0..2].each do |i|
>     [0..2].each do |j|
>         print $a[i][j]
>     end
> print "\n"
> end

> My output is 123456789--not what I'm looking for.  Any thoughts?