Open In App

Ruby | Integer – function

Last Updated : 06 Jan, 2020
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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 program for - method in Integer 
    
# Initialize numbers 
num1 = 15
num2 = 4 
  
# Prints subtraction
print num1 - num2


Output:

11

Example 2:




# Ruby program for - method in Integer 
    
# Initialize numbers 
num1 = 21
num2 = 3 
  
# Prints subtraction
print num1 - num2


Output:

18


Next Article

Similar Reads

three90RightbarBannerImg
  翻译: