→ 5 Ways to Splat in Ruby

Ruby 里星号的五种用法。

这个最有意思:

arr = [1, 2, 3, 4, 5]
first, *, last = arr
puts first # 1
puts last # 5