Narnach's blog

The thoughts of Wes "Narnach" Oldenbeuving

Ruby quick tip

I just discovered two different ways to create a fixed-length array filled with a default value.

Array.new(5,1) # => [1,1,1,1,1]
[1] * 5        # => [1,1,1,1,1]