module Squeezable

  def squeeze
    result = []
    previous = nil
    iterator = self.each
    loop do
      a = iterator.next
      result << a unless previous == a
      previous = a
    end
    result
  end

end

module Squeezable

  def squeeze
    result = []
    previous = nil
    for i in (0...self.length)
      a = self[i]
      result << a unless previous == a
      previous = a
    end
    result
  end

end

Use for loop instead of iterator for Squeezable.
Use for loop instead of iterator for Squeezable.