Hi.

find is a method you can use on an Enumerable. An Array is an Enumerable. The docs indicates that find accept a block and "Returns the first entry for which block is not false."

Search for blocks, this should solve your problem. :)

Guillaume Hivert
Ruby && Crystal Developper
LinkedIn Profile<https://fr.linkedin.com/in/ghivert>



On dc. 3 2016, at 11:29 pm, Micky Scandal <mickyscandal / gmail.com> wrote:
hello all. I've run into a snag in an assignment I'm doing. the description:

Return the first number from an Array that is less than a particular number - 'limit.' You should make use of Enumerable#find

and then gives me this code to work with:

def first_under(array, limit)

end

puts first_under([13, 21, 7, 0, 11, 106], 10) == 7

for the life of me I can't figure out how to make this work. I've feebaly tried a couple different things, but none including .find. I'm pretty much at a total loss. This should be so simple (i think) so I really don't know what I'm missing.
(supressed text/html)
Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>