Created
October 23, 2013 09:28
-
-
Save benedikt/7115437 to your computer and use it in GitHub Desktop.
In Rubinius, the `Array#each` method does not enumerate elements that are added while enumerating. Is this intentional or a bug?
This file contains hidden or 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
array = [1, 2] | |
array.each { |n| array << n * 2; break if n > 10 } | |
array | |
# ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0] | |
# => [1, 2, 2, 4, 4, 8, 8, 16, 16, 32] | |
# rubinius 2.1.1 (2.1.0 be67ed17 2013-10-18 JI) [x86_64-darwin12.5.0] | |
# => [1, 2, 2, 4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment