Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Returns true if for some index i in self, obj == self[i]; otherwise false:
[0, 1, 2].include?(2) # => true
[0, 1, 2].include?(3) # => false
 
               VALUE
rb_ary_includes(VALUE ary, VALUE item)
{
    long i;
    VALUE e;

    for (i=0; i<RARRAY_LEN(ary); i++) {
        e = RARRAY_AREF(ary, i);
        if (rb_equal(e, item)) {
            return Qtrue;
        }
    }
    return Qfalse;
}
            

Was this page useful?