------ art_109773_11831282.1168974408614
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Just noticed that a.map!{|e|e?' ':e} throws parse error on my machine, is
this the expected behavior?
Following statements work fine:
a.map!{|e|e||' '}
a.map!{|e|(e)?' ':e}
On 1/16/07, Chunyun Zhao <chunyun.zhao / gmail.com> wrote:
>
> If you know the size of the array, you could do:
>
> a ¨Âáù®îå÷¨±°¬ ¢©
>
> Or you could map the array afterwards:
>
> a.map!{|e|e?' ':e}
>
> On 1/16/07, Drew Olson <olsonas / gmail.com> wrote:
> >
> > I'd like to have my array behave like this: If I add an item to a[5],
> > a[0..5] will be equal to " " rather than nil. I tried to following:
> >
> > irb(main):001:0> a "]
> >