Created
September 27, 2013 03:42
-
-
Save polycarpou/6723828 to your computer and use it in GitHub Desktop.
creating my own each method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_each(arr) | |
count = 0 | |
while count <= arr.length | |
yield(arr[count]) | |
count += 1 | |
end | |
end | |
my_each([1,2,3,4,6]) do |x| | |
puts x | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment