Hi,

Rob Biedenharn wrote:
> def int_split(x)
>    return [0] if x.zero?
>    r = []
>    while x > 0
>      x, b = x.divmod 10
>      r.unshift b
>    end
>    r
> end
> 
Here is a little short version:

def int_split(x)
  r=[x];r[0,1]=*r[0].divmod(10)while r[0]>9;r
end

Regards,

Park Heesob
-- 
Posted via http://www.ruby-forum.com/.