J
Josselin
I wrote the following command
myRanges = [(0...2), (2...5), (5...10), (10...15), (15...25)]
myRanges.each_pair {|index, aRange| index if aRange.include?(1)}
I would like to get 0 as a result since 1 is falling into the first range....
but I got an error
undefined method `each_pair' for [0...2, 2...5, 5...10, 10...15, 15...25]:Array
how should I write it, if I want to get the index of the range where a
given number is falling...
thanks for your help
joss
myRanges = [(0...2), (2...5), (5...10), (10...15), (15...25)]
myRanges.each_pair {|index, aRange| index if aRange.include?(1)}
I would like to get 0 as a result since 1 is falling into the first range....
but I got an error
undefined method `each_pair' for [0...2, 2...5, 5...10, 10...15, 15...25]:Array
how should I write it, if I want to get the index of the range where a
given number is falling...
thanks for your help
joss