User code

1
2
3
4
5
6
array = [1,2,3,4,5]

array.each do |val|
  trace val
end

Stdlib

1
2
3
4
5
6
7
8
9
10
11
12
13
class Array
  def each
    i, len = 0, self.length

    while i < len
      yield raw_index(i)
      i += 1
    end
    
    self
  end
end