like this
range = (0..10)
how can I get number like this:
0 5 10
plus five every time but less than 10>
Try using .step() to go through at a given step.
(0..20).step(5) do |n| print n,' ' end
gives...
0 5 10 15 20
As mentioned by dominikh, you can add .to_a on the end to get a storable form of the list of numbers: (0..20).step(5).to_a
.to_a
(0..20).step(5).to_a