Skip to content

Instantly share code, notes, and snippets.

@sidazhang
Created February 20, 2013 11:35
Show Gist options
  • Save sidazhang/4994927 to your computer and use it in GitHub Desktop.
Save sidazhang/4994927 to your computer and use it in GitHub Desktop.
reverse words
def reverse_words(array)
results = array.split(" ")
new_results = []
results.length.times do |i|
new_results[i] = results[i].reverse
end
return new_results.join(" ")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment