Method: Array#each_index
- Defined in:
- lib/source/ruby.rb
#each_index ⇒ Object
call-seq:
ary.each_index { |index| block } -> ary
Calls block once for each index in ary, then returns ary.
%(a b c).each {|index| puts index + 100 } #=> ["a", "b", "c"]
produces:
100
101
102
2151 2152 2153 2154 |
# File 'lib/source/ruby.rb', line 2151 def each_index `for(var i=0,l=this.length;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 |