Skip to content

Instantly share code, notes, and snippets.

@sgonyea
Created October 24, 2011 04:52
Show Gist options
  • Save sgonyea/1308397 to your computer and use it in GitHub Desktop.
Save sgonyea/1308397 to your computer and use it in GitHub Desktop.
a = (1..10).to_a
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
b = (11..20).to_a
# => [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
[a,b].transpose.flatten
# => [1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19, 10, 20]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment