From: Pistos Christou Date: 2006-03-17T02:54:04+09:00 Subject: Re: build 3x3 table from one array forest wrote: > I am stuck trying to figure out how to take an array of data and > dynamically build a 3x3 html table from it without standard for loops. > > Here is the code in JavaScript: *snip* > Can someone point me in the right direction for how to do this. I found > each_index but still was at a loss. Without giving it a lot of thought, I'd do something to the effect of: rows = [ [ 'col1', 'col2', 'col3' ], [ 'cOl1', 'Col2', 'col3' ], [ 'col1', 'COL2', 'COl3' ], ] output = '' output << '' rows.each do |row| output << '' row.each do |col| output << "" end output << '' end output << '
#{col}
' puts output -- Posted via http://www.ruby-forum.com/.