Skip to content

Instantly share code, notes, and snippets.

@kkchu791
Created November 6, 2015 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkchu791/eda1e292a3bbb67ed682 to your computer and use it in GitHub Desktop.
Save kkchu791/eda1e292a3bbb67ed682 to your computer and use it in GitHub Desktop.
def array
a = (1..100).to_a
a.each_slice(10).to_a
end
p array
@charliemcelfresh
Copy link

Kirk, this is an excellent idea. Might be nice to just give it an input, and use that:

def array(n)
  (1..n**2).to_a.each_slice(n).to_a
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment