splat 展開 (Ruby)
Ruby
Published: 2019-10-06

やったこと

splat 展開を使ってみます。

確認環境

$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin17]

調査

$ irb
irb(main):001:0> [*3..8]
=> [3, 4, 5, 6, 7, 8]
irb(main):002:0> [*'bx'..'cg']
=> ["bx", "by", "bz", "ca", "cb", "cc", "cd", "ce", "cf", "cg"]

参考