From: Dave Thomas Date: 2001-04-24T12:39:37+09:00 Subject: [ruby-talk:14131] Re: rasworth matrix "rashworth" writes: > What is the Ruby code to produce a 3 row by 2 column matrix > of pixel elements, ie black and white? > > Thank you very much. > > Bob Ashworth Bob: First - a request. When you ask a new question, could you do it by posting a new message, rather than by replying to some totally unrelated one. In terms of your question, it's hard to answer as it stands. Is the question "how do I store a 2d matrix", or it is "how do I write it out", or ... Here's a simple 2d array: arr = [ [ 1, 0 ], [ 0, 0 ], [ 1, 1 ] ] And here's a nested loop that accesses the elements for row in 0..2 for col in 0..1 print arr[row][col], " " end print "\n" end Does that help? Dave