Peña, Botp wrote:
>     ar2 = ar1.collect { |x| x<45000 ? (x + incVal) : x}
>  or
>     ar2 = ar1.collect { |x| if x<45000 then (x + incVal) else x end}
>  or
>     ar2 = ar1.select{|x| x<45000}.collect{|x| x + incVal}
> 
> i usually prefer the last one, since i think like: "select those 
> elements < 45000, then with those collections, increment each". but that 
> is just me.
> 
> welcome to ruby.
> kind regards -botp

The last one is not equivalent to the other two. It will drop values >= 
45000.

Regards
Stefan
-- 
Posted via http://www.ruby-forum.com/.