From: FireAphis Date: 2007-10-03T16:50:03+09:00 Subject: Re: Searching through a sorted array On Oct 3, 9:30 am, Peter Szinek wrote: > FireAphis wrote: > > Hello, > > > I have a very big array of objects sorted by one of its numeric data > > members. During the flow of my application I need occasionally to get > > all the elements in a specific range. > > Then why not > > my_array[start..end] ? > > Cheers, > Peter > __http://www.rubyrailways.comhttp://scrubyt.org Sorry if my explanation has been misleading. The array isn't necessarily comprised of continuous or consecutive numbers. Moreover they don't necessarily start from zero. For example: my_array = [-100, -99, -2, 0, 3, 125, 1742, 1234568763] now I want to get all the elements bigger than 1 and smaller than 1000. AFAIK my_array[1..1000] doesn't help in this case.