Method: Numeric#times

Defined in:
lib/source/ruby.rb

#timesObject

call-seq:

num.times { |i| block } -> num

Iterates block num times, passing in values from zero to num - 1, then returns num.

5.times do |i|
  puts i
end

produces:

0
1
2
3
4


4610
4611
4612
4613
# File 'lib/source/ruby.rb', line 4610

def times
  `for(var i=0,l=this.valueOf();i<l;++i){try{#{yield `i`};}catch(e){switch(e.__keyword__){case 'next':break;case 'break':return e.__return__;break;case 'redo':--i;break;default:throw(e);};}}`
  return self
end