Ruby | Numeric positive? function Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The positive?() is an inbuilt method in Ruby returns a boolean value. It returns true if the number is a positive one, else it returns false. Syntax: num.positive?()Parameters: The function needs a number which is to be checked for. Return Value: It returns returns a boolean value. Example 1: CPP # Ruby program for positive?() # method in Numeric # Initialize a number num1 = 15 # Prints positive or not puts num1.positive?() Output: true Example 2: CPP # Ruby program for positive?() # method in Numeric # Initialize a number num1 = -15 # Prints positive or not puts num1.positive?() Output: false Comment More infoAdvertise with us Next Article Ruby | Numeric phase() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Numeric-class Similar Reads Ruby | Numeric phase() function The phase() is an inbuilt method in Ruby returns 0 if the value is positive, else it returns a float value pi. Syntax: num.phase() Parameters: The function needs a number which is to be checked. Return Value: It returns zero if the value is positive, else it returns a float value pi. Example 1: Ruby 1 min read Ruby | Numeric phase() function The phase() is an inbuilt method in Ruby returns 0 if the value is positive, else it returns a float value pi. Syntax: num.phase() Parameters: The function needs a number which is to be checked. Return Value: It returns zero if the value is positive, else it returns a float value pi. Example 1: Ruby 1 min read Ruby | Numeric quo() function The quo() is an inbuilt method in Ruby returns the most exact division, whether it be a float or a rational one. Syntax: num.quo() Parameters: The function needs a number which is to be checked. Return Value: It returns the most exact division. Example 1: Ruby # Ruby program for quo() # method in Nu 1 min read Ruby | Numeric quo() function The quo() is an inbuilt method in Ruby returns the most exact division, whether it be a float or a rational one. Syntax: num.quo() Parameters: The function needs a number which is to be checked. Return Value: It returns the most exact division. Example 1: Ruby # Ruby program for quo() # method in Nu 1 min read Ruby | Numeric real? function The real?() is an inbuilt method in Ruby returns a boolean value. It returns true if the number is a negative one, else it returns false. Syntax: num.real?() Parameters: The function needs a number which is to be checked for. Return Value: It returns returns a boolean value. Example 1: CPP # Ruby pr 1 min read Ruby | Numeric real? function The real?() is an inbuilt method in Ruby returns a boolean value. It returns true if the number is a negative one, else it returns false. Syntax: num.real?() Parameters: The function needs a number which is to be checked for. Return Value: It returns returns a boolean value. Example 1: CPP # Ruby pr 1 min read Like