Open In App

Ruby | Integer + method

Last Updated : 06 Jan, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
The + is an inbuilt method in Ruby returns the addition of two numbers. It returns num1 + num2.
Syntax: num1 + num2 Parameters: The function accepts no parameter. Return Value: It returns the addition of two numbers.
Example 1: Ruby
# Ruby program for + method in Integer 
  
# Initialize numbers 
num1 = 15
num2 = 4 

# Prints addition
print num1 + num2
Output:
19
Example 2: Ruby
# Ruby program for + method in Integer 
  
# Initialize numbers 
num1 = 21
num2 = 3 

# Prints addition
print num1 + num2
Output:
24

Next Article

Similar Reads