Ruby Float zero?() method with example Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report Float#zero() : zero() is a float class method which checks whether the float value is zero. Syntax: float.zero() Parameter:float value which is to be checked Return: Boolean value return true if value is zero otherwise return false Example #1: Ruby # Ruby code for zero?() method # Initializing value a = -100.7 * 0 b = -0 c = (22 + 7.1) * 4 # Printing a puts "a is zero : #{a.zero?}\n\n" # Printing b puts "b is zero : #{b.zero?}\n\n" # Printing c puts "c is zero : #{c.zero?}\n\n" Output : a is zero : true b is zero : true c is zero : false Example #2: Ruby # Ruby code for zero?() method # Initializing value a = 2.0 b = 0.000000001 # Printing result puts "a is zero : #{a.zero?}\n\n" puts "b is zero : #{b.zero?}\n\n" Output : a is zero : false b is zero : false Comment More infoAdvertise with us Next Article Ruby Float zero?() method with example M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Float-class Similar Reads Ruby Float nan?() method with example Float nan?() is a float class method that checks whether the value is 'not a number'. 'Not A Number' means an invalid IEEE floating-point number. Syntax: float.nan?()Parameter: float value to be passedReturn: Return true - if the value is 'not a number' otherwise return false Example #1:Â Â Ruby # Ru 1 min read Ruby Float divmod() method with example Float divmod() is a float class method that returns an array having the quotient and remainder on dividing two numbers. Syntax: float.divmod()Parameter: float values - dividend and divisorReturn: An array with quotient and remainder. Example #1:Â Ruby # Ruby code for divmod() method # Initializing v 1 min read Ruby Float negative() method with example Float negative() is a float class method which checks whether the float value is negative. Syntax: float.negative() Parameter: float value which is to be checked Return: Boolean value return false - if value is positive and return true - if value is negative Example #1: Ruby # Ruby code for negative 1 min read Ruby Float positive() method with example Float positive() is a float class method which checks whether the float value is positive. Syntax: float.positive() Parameter: float value which is to be checked Return: Boolean value return true - if value is positive or return false - if value is negative Example #1:Â Ruby # Ruby program for posit 1 min read Ruby Integer odd? function with example The odd? function in Ruby returns a boolean value. It returns true if the number is odd, else it returns false. Syntax: number.odd? Parameter: The function takes the integer which is to be checked for odd or not. Return Value: The function returns a boolean value which determines if the value is odd 1 min read Like