Arrays • Exercise 6/6

Find First Match

00:00
0
15 points

Instructions

Create a function first_long_word that returns the first word
longer than 5 characters from an array.

Use the find method (also called detect):
ruby
[1, 2, 3].find { |n| n > 1 } # => 2

find returns the first matching element, or nil if none found.

Your Code

Results

Click "Run Tests" to see results