Mastering Enumerable, Part 1

Flashcard 2 of 7

Is there a more direct way to accomplish this?

widgets.select { |widget| widget.size > 3 }.first

detect makes things a little shorter:

widgets.detect { |widget| widget.size > 3 }
Return to Flashcard Results