I\'m trying to create method named longest_word that takes a sentence as an argument and The function will return the longest word of the sentence.
longest_word
My c
sort_by! and reverse!
sort_by
reverse
def longest_word(sentence) longw = sentence.split(" ") longw.sort_by!(&:length).reverse! p longw[0] end longest_word("once upon a time long ago a very longword")