escaping the .each { } iteration early in Ruby

后端 未结 0 1867
孤独总比滥情好
孤独总比滥情好 2021-02-11 13:33

code:

 c = 0  
 items.each { |i|  
   puts i.to_s    
   # if c > 9 escape the each iteration early - and do not repeat  
   c++  
 }  

I

相关标签:
回答
  • 消灭零回复
提交回复
热议问题