On Mar 20, 2010, at 03:51 , David Vlad wrote:

> I apologize. I actually managed to get the until loops working after 
> some reinstalling. However, the .collect method still dosnt work and I 
> really want to use it. The code looks like this:
> 
> 
> array = [1,2,5,7]
> 
> array.collect do |x|
> x = x*2
> end
> 
> puts array.inspect
> 
> 
> After I have run this code it still says the array is [1,2,5,7].

% ri Array.collect
---------------------------------------------------------- Array#collect
     array.collect {|item| block }  -> an_array
     array.map     {|item| block }  -> an_array
------------------------------------------------------------------------
     Invokes _block_ once for each element of _self_. Creates a new
     array containing the values returned by the block. See also
     +Enumerable#collect+.

        a = [ "a", "b", "c", "d" ]
        a.collect {|x| x + "!" }   #=> ["a!", "b!", "c!", "d!"]
        a                          #=> ["a", "b", "c", "d"]