Ruby | Integer - function Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The - is an inbuilt method in Ruby returns the subtraction of two numbers. It returns num1 - num2. Syntax: num1 - num2 Parameters: The function accepts no parameter. Return Value: It returns the subtraction of two numbers. Example 1: Ruby # Ruby program for - method in Integer # Initialize numbers num1 = 15 num2 = 4 # Prints subtraction print num1 - num2 Output: 11 Example 2: Ruby # Ruby program for - method in Integer # Initialize numbers num1 = 21 num2 = 3 # Prints subtraction print num1 - num2 Output: 18 Comment More infoAdvertise with us Next Article Ruby | Integer upto() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Integer-class Similar Reads Ruby | Integer >= function The >= is an inbuilt method in Ruby returns true if the number is greater than or equal to the given number, else it returns false. Syntax: num1 >= num2 Parameters: The function accepts no parameter. Return Value: It returns true if the number is greater than or equal to the given number, else 1 min read Ruby | Integer >= function The >= is an inbuilt method in Ruby returns true if the number is greater than or equal to the given number, else it returns false. Syntax: num1 >= num2 Parameters: The function accepts no parameter. Return Value: It returns true if the number is greater than or equal to the given number, else 1 min read Ruby | Integer >= function The >= is an inbuilt method in Ruby returns true if the number is greater than or equal to the given number, else it returns false. Syntax: num1 >= num2 Parameters: The function accepts no parameter. Return Value: It returns true if the number is greater than or equal to the given number, else 1 min read Ruby | Integer upto() function The upto function in Ruby returns all the numbers from a given to number itself. It iterates the given block, passing in increasing values from number1 up to number2. If no block is given, an Enumerator is returned instead. Syntax: (number1).upto(number2) Parameter: The function takes number1 and nu 2 min read Ruby | Integer upto() function The upto function in Ruby returns all the numbers from a given to number itself. It iterates the given block, passing in increasing values from number1 up to number2. If no block is given, an Enumerator is returned instead. Syntax: (number1).upto(number2) Parameter: The function takes number1 and nu 2 min read Ruby | Integer upto() function The upto function in Ruby returns all the numbers from a given to number itself. It iterates the given block, passing in increasing values from number1 up to number2. If no block is given, an Enumerator is returned instead. Syntax: (number1).upto(number2) Parameter: The function takes number1 and nu 2 min read Like