User code

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

array.each do |val|
  trace val
end

Stdlib

class Array
  def each
    i, len = 0, self.length

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