Rubyのシンプルなループ処理
rubyは、様々なループ処理の書き方をサポートしている。
多すぎる。
①for i in 3..7;...;end
②(3..7).each{|i| ... }
[*3...7].each{|i| ... }
③3.upto(7){|i| ... }
④i=2;while i+=1 and i<=7;do ...;end
⑤8.times{|i| ...}
基本的な形は、②だと思うが、
最もシンプルなのは、0から始まる⑤である。
参考 https://style.potepan.com/articles/4783.html