From: Sebastian Hungerecker Date: 2008-06-14T06:49:12+09:00 Subject: Re: Print Numbers Vertically Chris Foley wrote: >  I am trying to figure out how I can print an array of numbers > vertically. For example > > a = [  1, 24, 546, 1000, 32, 256 ] > > output (spaces optional) : > > 1 2 5 1 3 2 > 4 4 0 2 5 > 6 0   6 >       0 a = [ 1, 24, 546, 1000, 32, 256 ] height = a.max.to_s.length a.map do |num| num.to_s.ljust(height).split(//) end.transpose.each do |line| puts line.join(" ") end Prints: 1 2 5 1 3 2 4 4 0 2 5 6 0 6 0 HTH, Sebastian -- NP: Black Sabbath - Killing Yourself to Live Jabber: sepp2k@jabber.org ICQ: 205544826