0

what is the difference between include?() and cover? () in ruby.. please

for which each one used and is that any different in Return value...

16th Nov 2018, 3:30 AM
Ali Abdullah Amrah
Ali Abdullah Amrah - avatar
1 Antwort
0
Returns true if the given object is present in self (that is, if any object == anObject), false otherwise. a = [ "a", "b", "c" ] a.include?("b") #=> true a.include?("x") #=> false Returns true if obj is between beg and end, i.e beg <= obj <= end (or endexclusive when exclude_end? is true). ("a".."z").cover?("d") #=> true ("a".."z").cover?("5") #=> false
16th Nov 2018, 4:35 AM
MsJ
MsJ - avatar