Hello --

On Wed, 7 Nov 2001 puzzled186 / hotmail.com wrote:

> I'd like to be able to do something like:
> {1..100=>"a",101..300=>"c", 500..1000=>"r"}
>
> The syntax accepts it, but it doesn't behave the way I'd like (always
> comes up nil).
>
> Anyway to pull this off (currently using a case statement).

It depends.  What are you trying to do?  :-)

Something like:

  h = {1..100=>"a",101..300=>"c",500..1000=>"r"}

  n = 200
  puts h.find {|k,v| k === n} [1]  # => c

?


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav