Created
November 24, 2012 06:45
-
-
Save sadah/4138687 to your computer and use it in GitHub Desktop.
each_slice
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
# こんな感じのコードが | |
ary = (1..100).to_a | |
while ary.size != 0 | |
p ary.slice!(0,15) | |
end | |
# こんな感じに書ける。 | |
(1..100).to_a.each_slice(15){|a| p a} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment