Ruby | Range include?() function Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The include?() is an inbuilt method in Ruby returns a boolean value true if the given object lies within the given range, else it returns false. Syntax: range1.include?(obj) Parameters: The function accepts an object which is to be checked for. Return Value: It returns a boolean value true if the given object lies within the given range, else it returns false. Example 1: Ruby # Ruby program for include? method in Range # Initialize range range1 = (0..10) # Prints if lies or not puts range1.include?(6) puts range1.include?(13) Output: true false Example 2: Ruby # Ruby program for include? method in Range # Initialize range range1 = (2..5) # Prints if lies or not puts range1.include?(7) puts range1.include?(11) Output: false false Comment More infoAdvertise with us Next Article Ruby | Range inspect() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Range-class Similar Reads Ruby | Range inspect() function The inspect() is an inbuilt method in Ruby returns the range object in a printable form Syntax: range1.inspect() Parameters: The function accepts no parameter Return Value: It returns the range object in a printable form Example 1: Ruby # Ruby program for inspect() # method in Range # Initialize ran 1 min read Ruby | Range inspect() function The inspect() is an inbuilt method in Ruby returns the range object in a printable form Syntax: range1.inspect() Parameters: The function accepts no parameter Return Value: It returns the range object in a printable form Example 1: Ruby # Ruby program for inspect() # method in Range # Initialize ran 1 min read Ruby | Set include?() function The include?() is an inbuilt method in Ruby returns true if the set contains the given object. It returns false if it does not contains the given object. Syntax: s1_name.include?(object) Parameters: The function accepts a mandatory parameter object whose presence is to be checked for. Return Value: 1 min read Ruby | Set include?() function The include?() is an inbuilt method in Ruby returns true if the set contains the given object. It returns false if it does not contains the given object. Syntax: s1_name.include?(object) Parameters: The function accepts a mandatory parameter object whose presence is to be checked for. Return Value: 1 min read Ruby | Hash include?() function Hash#include?() is a Hash class method which checks whether the given key is present in hash. Syntax: Hash.include?() Parameter: Hash values Return: true - if given key"" is present in hash otherwise return false Example #1 : Ruby # Ruby code for Hash.has_value?() method # declaring Hash value a = { 2 min read Ruby | Range member? function The member?() is an inbuilt method in Ruby returns a boolean value true if the given object lies within the given range, else it returns false. Syntax: range1.member?(obj) Parameters: The function accepts an object which is to be checked for. Return Value: It returns a boolean value true if the give 1 min read Like