fork download
  1. #Alright so this is a method to extract the longest word from a string.
  2.  
  3. def longest_word(string)
  4. longest = [] #I figure I could store the longest word here?
  5. string.each do |word| #Should I be using each? Or a different method?
  6. word <=> word # I don't know how to compare the words to each other.
  7. longest << word
  8. end
  9. end
Success #stdin #stdout 0.05s 9608KB
stdin
Standard input is empty
stdout
Standard output is empty