From: David Madden Date: 2007-01-16T04:22:40+09:00 Subject: Re: Can anyone try to solve this problems? > 2. Write a function to find the longest string in an array of > strings. > Is this from the Brian Schroder Ruby Course PDF? Here is my function (no doubt a better on exists): def longest(a) word = '' a.each do |i| if word.length < i.length word = i end end word end a = ['a', 'fish', 'is', 'messy', 'dog'] puts longest(a)