# Range methods include? and member?

**URL:** <https://www.ruby-forum.com/t/range-methods-include-and-member/95571>\
**Category:** Ruby\
**Created:** [June 6, 2006, 4:51pm UTC](https://www.ruby-forum.com/t/range-methods-include-and-member/95571 "2006-06-06T16:51:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![markcasio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@markcasio](https://www.ruby-forum.com/u/markcasio)\
**Post date:** [June 6, 2006, 4:51pm UTC](https://www.ruby-forum.com/t/range-methods-include-and-member/95571/1 "2006-06-06T16:51:26Z")

</div>

Do the Range methods include? and member? now do the same thing?  
I thought include? returned true if the given value was within the  
range bounds and member? returned true if the given value would be  
encountered when iterating through the range.

For example,

r = 1…10  
r.include?(5.5) # results in true  
r.member?(5.5) # results in false

The print version of Pickaxe second edition has this example on page  
599. It shows these methods returning different values, but the latest  
PDF version shows them returning the same thing. I tried this example  
in irb using Ruby 1.8.4 and they now seem to return the same values.

---

<div class="post-metadata">

**Author:** ![markcasio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@markcasio](https://www.ruby-forum.com/u/markcasio)\
**Post date:** [June 6, 2006, 4:54pm UTC](https://www.ruby-forum.com/t/range-methods-include-and-member/95571/2 "2006-06-06T16:54:35Z")

</div>

On Jun 6, 2006, at 9:48 AM, Mark V. wrote:

> Do the Range methods include? and member? now do the same thing?

Yes, they do. I ran into this issue a while back and had to come  
here to get it confirmed too. 😉

James Edward G. II
