From: Alfonso Caponi Date: 2009-12-24T23:27:55+09:00 Subject: Re: newbie: argh! array of array Alfonso Caponi wrote: > Hi forum, > > I'm fighting with a function like this! :) > > > function(["x","y","x"]) do |a,b|c| > printf("%10s %10s %10s\n",a,b,c) > end > > > It works fine, but I would like a "pseudo-code" like this :) > > > new array > > function(["x","y","z"]) do |a,b|c| > push a,b,c into array > end > > if array is not empty > printf("%10s %10s %10s\n",a,b,c) > end > > > Which is the best way to write it? > > Thank you very very much, > Al Check it out! :) array = [] function(["x","y"]) do |a,b| array.push([["#{a.value}"],["#{b.value}"]]) end if not array.empty? array.each {|z,k| printf("%10s %s\n",z,k)} end -- Posted via http://www.ruby-forum.com/.