2009/11/2 NachoKB <[email protected]>:
> 2009/11/2 NachoKB <[email protected]>
>>
>> ¿Algo así?
>>
>>> >> a, b = 1, 2
>>> => [1, 2]
>>> >> a, b = [a,b].map { |x| x += 1 }
>>> => [2, 3]
>
>
> por las dudas que me digas que la x es una variable auxiliar, dejame hacer
> trampa:
>
>> a, b = [a,b].map &:next
>

Eso solo sirve si tenes ActiveSupport cargado.

-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
_______________________________________________
Ruby mailing list
[email protected]
http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar

Responder a