===

rng === obj รข true or false
Instance Public methods

Returns true if obj is an element of the range, false otherwise. Conveniently, === is the comparison operator used by case statements.

case 79
when 1..50   then   print "low\n"
when 51..75  then   print "medium\n"
when 76..100 then   print "high\n"
end

produces:

high
doc_ruby_on_rails
2015-05-01 01:09:59
Comments
Leave a Comment

Please login to continue.