ハロの外部記憶インターフェイス

そろそろ覚える努力が必要かも…

Numericクラス

ceil

自身と同じかそれ自身より大きいな整数で最初の物を返す

2.9.ceil  #=3
-2.9.ceil  #=-2

floor

それ自身より小さな整数の内最大を返す

2.9.floor   #=2
-2.9.floor  #=-3

round

最も近い整数を返す

2.9.round #=3
2.1.round #=2
-2.9.round #=-3
-2.1.round #=-2

truncate

自身と0の間にある整数で最も近いものを返す

2.9.truncate  #=2
-2.9.truncate  #=2

abs

数字の絶対値

-3.abs  #=3

step(max,n)

maxまで、n単位で繰り返す

1.step(100, 2){|n| puts n}
1
3
5
...

downto(min)

minまで減らしていく

100.downto(1) { |n| puts n}
100
99
98
...