Skip to content

Instantly share code, notes, and snippets.

@todlazarov
Last active March 8, 2016 18:43
Show Gist options
  • Save todlazarov/33207ebaaf8dae1f30a4 to your computer and use it in GitHub Desktop.
Save todlazarov/33207ebaaf8dae1f30a4 to your computer and use it in GitHub Desktop.
def times(number)
counter = 0
while counter < number do
yield(counter)
counter += 1
end
number
end
times(3) do |num|
puts num
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment