#times,upto,downto,each,step示例
3.times { print "Hi!" } #Hi!Hi!Hi!
puts "\n"
1.upto(9) {|i| print i if i<7 }#123456
puts "\n"
9.downto(1){|i| print i if i<7 } #654321
puts "\n"
(1..9).each {|i| print i if i<7} #123456
puts "\n"
0.step(11,2) {|i| print i } #0369
评论
发表评论

您还没有登录,请登录后发表评论

weiweichen1985
搜索本博客
我的相册
E6c390da-d0cb-3350-97d4-83ec6586912c-thumb
2008-6-26
共 122 张
存档
最新评论