chessboard = Array.new(8) {|idx| Array.new(8, “”)}
chessboard[3][3] = “pawn”This will do what you expect. Read the documentation for Array.new It
will explain all these subtle nuances.Blessings,
TwP
Thanks. That works great. I read and tried to understand the
documentation
for Array.new but failed to understand what I read It’s nice that I
don’t
have to store the allotted dimensions. It returns an error message if
the
first number is out of range. If the second number is out of range, it
makes that
particular array longer.
Now all I have to do is file that information away somewhere when I can
find
it when I need it.
Charles G. – Phoenix, AZ … where you can bake the chill out of your
bones.