Skip to content

Instantly share code, notes, and snippets.

@eladmeidar
Created November 20, 2014 08:32
Show Gist options
  • Save eladmeidar/56046313de01bc338d39 to your computer and use it in GitHub Desktop.
Save eladmeidar/56046313de01bc338d39 to your computer and use it in GitHub Desktop.
def proclaim
new_array = [] # Creating a new array to collect the words
string.split.each do |word| # Iterate over each word
new_array << "#{word}!" # add same words we are iterating over, just with an exclamation mark.
end
new_array.join(' ') # return new words array as a string
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment