Hi --

On Sun, 13 Aug 2006, Dark Ambient wrote:
>
> On 8/12/06, Robert Klemme <shortcutter / googlemail.com> wrote:
>> dblack / wobblini.net wrote:
>> > Hi --
>> >
>> > On Sat, 12 Aug 2006, Dark Ambient wrote:
>> >
>> >> What would be the proper call to a multi array either collect or map
>> >> ?
>> >
>> > There's no single proper thing to do; it depends entirely on the task
>> > at hand.
>> 
>> DA, note also that map and collect are synonyms.  It doesn't matter which 
>> of
>> the two you use. :-)
>> 
> I know they are interchangeable
> But I can't make it work.
>
> For instance -
> x = [["john", "doe"],["mary", "jane"],["jim","richards"],['sue","scott"]]
> y = x.map {|i| i + "name" }
> p y
>
> It's returning nil on me ????

That should give you an error, because you're trying to add a string
to an array.  Try:

   y = x.map {|i| i + ["name"] }


David

-- 
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
   ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <-----
http://dablog.rubypal.com        => D[avid ]A[. ]B[lack's][ Web]log
http://www.manning.com/black     => book, Ruby for Rails
http://www.rubycentral.org       => Ruby Central, Inc.