[ruby-talk:02452] Re: Iterator into array

From: mengx@...
Date: 2000-04-11 16:59:41 UTC
List: ruby-talk #2452
> 
>   (1..10).each(&into(a = []))
>   p a   # [1,2,3,4,5,6,7,8,9,10]
> 
> 							matz.
I wonder how many more chars one would really type compared to the conventional one.
a=[];(1..10).each {|i| a<<i}
(1..10).each(&into(a = []))

Only one :-).  After using Ruby for a while, the only thing I feel really
a should-have for syntax is the keyword argument. I wonder why it can not be
added into 1.6. 

In This Thread

Prev Next