Range
参考:
cover?
参考:
instance method Range#=== (Ruby 2.6.0)
step
(1..8).step(2).to_a # => [1, 3, 5, 7] 1.step(6).to_a # => [1, 2, 3, 4, 5, 6] 1.step(8, 2).to_a # => [1, 3, 5, 7] 7.step(1, -2).to_a # => [7, 5, 3, 1]
参考:
instance method Range#% (Ruby 2.6.0)
instance method Numeric#step (Ruby 2.6.0)
Declaring an integer Range with step != 1 in Ruby – Stack Overflow
times
参考:
instance method Integer#times (Ruby 2.6.0)
upto
参考:
instance method Integer#upto (Ruby 2.6.0)
downto
参考:
instance method Integer#downto (Ruby 2.6.0)
まとめ
参考: