Skip to content

Instantly share code, notes, and snippets.

@mana8626
Created January 4, 2012 08:18
Show Gist options
  • Save mana8626/1559071 to your computer and use it in GitHub Desktop.
Save mana8626/1559071 to your computer and use it in GitHub Desktop.
eachを実装してみたった!
class Array
def eachfor &blk
i = 0
while i < self.length
blk.call self[i]
end
i += 1
end
end
end
[1, 2, 3, 4, 5, 6].eachfor do |e|
puts e * e
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment