0

Since a week back from now I started to learn ruby. In array, I couldn't understand how the below statements works? I have an Array of integers i.e.

ary = [0, 4, 7, 10, 12]
puts ary.bsearch {|x| 1 - x/4 }  
puts ary.bsearch {|x| 2 - x / 3 }

output :
4
7

Please explain.

amit325
  • 101
  • 1
  • 7

0 Answers0