I'm reading the "Pickaxe" ruby book and I came across this example:
def meth_three
100.times do |num|
square = num*num
return num, square if square > 1000
end
end
If you call meth_three in irb it returns the first integer between 1 and 100 that has a square > 1000:
meth_three # => [32, 1024]
My question is, how does the times method know how to loop through each integer between 1..100 to pass as the argument to the |num| parameter?