Skip to content

Instantly share code, notes, and snippets.

@beezeebly
Last active January 1, 2016 16:59
Show Gist options
  • Save beezeebly/8173981 to your computer and use it in GitHub Desktop.
Save beezeebly/8173981 to your computer and use it in GitHub Desktop.
Ruby pop and push explained
authors = ["Arthur Conan Doyle", "J.K. Rowling", "J.R.R. Tolkien", "Hanif Kureishi"]
authors.push("Neil Gaiman")
authors # => ["Arthur Conan Doyle",
# "J.K. Rowling",
# "J.R.R. Tolkien",
# "Hanif Kureishi",
# "Neil Gaiman"]
authors.pop()
authors # => ["Arthur Conan Doyle",
# "J.K. Rowling",
# "J.R.R. Tolkien",
# "Hanif Kureishi"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment