Skip to content

Instantly share code, notes, and snippets.

@samdvr

samdvr/bang.rb Secret

Last active February 1, 2017 16:23
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 samdvr/5257c9c4a2b71464ec10d493c4abf6a5 to your computer and use it in GitHub Desktop.
Save samdvr/5257c9c4a2b71464ec10d493c4abf6a5 to your computer and use it in GitHub Desktop.
bang
arr = [5, 3, 8]
res = arr.reverse!
print arr # [8, 3, 5]
print res # [8, 3, 5]
arr = [5, 3, 8]
res = arr.reverse
print arr # [5, 3, 8]
print res # [8, 3, 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment