Created
May 18, 2010 02:56
-
-
Save dacc/404553 to your computer and use it in GitHub Desktop.
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
ruby-1.9.1-p378 > # i'd like this to print 0, 1, 2, 3. not sure how to change things. | |
ruby-1.9.1-p378 > | |
ruby-1.9.1-p378 > ps = [] | |
=> [] | |
ruby-1.9.1-p378 > for i in 0..3 | |
ruby-1.9.1-p378 ?> ps.push(proc { puts i }) | |
ruby-1.9.1-p378 ?> end | |
=> 0..3 | |
ruby-1.9.1-p378 > | |
ruby-1.9.1-p378 > for p in ps | |
ruby-1.9.1-p378 ?> p.call | |
ruby-1.9.1-p378 ?> end | |
3 | |
3 | |
3 | |
3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment