Skip to content

Instantly share code, notes, and snippets.

@banister
Created June 14, 2011 09:18
Show Gist options
  • Save banister/1024566 to your computer and use it in GitHub Desktop.
Save banister/1024566 to your computer and use it in GitHub Desktop.
pry(main)> show-method for_
From: (pry) @ line 0:
Number of lines: 6
def for_(var, cond, inc)
while(cond.call)
yield var
inc.call
end
end
pry(main)> for_(j=0, ->{j<3}, ->{j+=1}) { puts j }
0
1
2
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment