Skip to content

Instantly share code, notes, and snippets.

@MrBean83
Created July 28, 2013 15:24
Show Gist options
  • Select an option

  • Save MrBean83/6098950 to your computer and use it in GitHub Desktop.

Select an option

Save MrBean83/6098950 to your computer and use it in GitHub Desktop.
"Reverse Words"
def reverse_words(str)
words = str.split(" ")
rev = words.reverse_each
print rev
end
----------
def reverse_words(str)
words = str.split(" ")
word = words.each.to_s
print word.reverse!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment