Ruby Integer even? function with example Last Updated : 24 Jun, 2020 Comments Improve Suggest changes Like Article Like Report The even? function in Ruby returns a boolean value. It returns true if the number is even, else it returns false. Syntax: number.even? Parameter: The function takes the integer which is to be checked for even or not. Return Value: The function returns a boolean value which determines if the value is even or not. Example #1: Ruby # Ruby program of Integer even? function # Initializing the numbers num1 = 19 num2 = 2 num3 = 28 num4 = 13 # Prints the integer division # and its remainder puts num1.even? puts num2.even? puts num3.even? puts num4.even? Output: false true true false Example #2: Ruby # Ruby program of Integer even? function # Initializing the numbers num1 = 18 num2 = 200 num3 = 2987 num4 = 13 # Prints the integer division # and its remainder puts num1.even? puts num2.even? puts num3.even? puts num4.even? Output: true true false false Comment More infoAdvertise with us Next Article Ruby Integer even? function with example G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Integer-class Similar Reads Ruby Integer div() function with example The div() function in Ruby returns the integer division of two numbers. Syntax: (number1).div(number2) Parameter: The function needs two numbers number1 and number2, where number1 is the dividend and number2 is the divisor. Return Value: The function returns the integer division of two numbers. Exam 1 min read Ruby Integer abs() function with example The abs() function in Ruby returns the absolute value of the integer. Syntax: (number).abs Parameter: The function takes the integer whose absolute value is to be returned. Return Value: The function returns the absolute value of the integer. Example #1: Ruby # Ruby program Integer abs() function # 1 min read Ruby Integer divmod() function with example The divmod() function in Ruby returns integer division value and the remainder. Syntax: (number1).divmod(number2) Parameter: The function takes two number number1 and number2 whose integer division and remainder is returned. Return Value: The function returns the integer division value and the remai 1 min read Ruby Integer downto() function with example The downto() function in Ruby returns all the numbers less than equal to number and greater than equal to limit. It iterates the given block, passing in decreasing values from int down to and including limit. If no block is given, an Enumerator is returned instead. Syntax: (number).downto(limit) Par 2 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