Skip to content

Instantly share code, notes, and snippets.

@crossaidi
Created May 24, 2014 19:41
Show Gist options
  • Save crossaidi/87116821cebd2dd4131c to your computer and use it in GitHub Desktop.
Save crossaidi/87116821cebd2dd4131c to your computer and use it in GitHub Desktop.
each_slice.rb
(1..10).each_slice(3) {|a| p a}
# outputs below
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
[10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment