Skip to content

Instantly share code, notes, and snippets.

@shinokada
Created May 3, 2014 04:48
Show Gist options
  • Save shinokada/11491787 to your computer and use it in GitHub Desktop.
Save shinokada/11491787 to your computer and use it in GitHub Desktop.
# Assign array values to different variables
a = [99, 97, 89, 99, 97]
v1, v2, *v3 = a.join(',').split(',')
# => ["99", "97", "89", "99", "97"]
v1
# => "99"
v2
# => "97"
v3
# => ["89", "99", "97"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment