Skip to content
Related Articles

Related Articles

Ruby | Integer == method

Improve Article
Save Article
Like Article
  • Last Updated : 06 Jan, 2020

The == is an inbuilt method in Ruby returns true if both numbers are equal, else it returns false

Syntax: num1 == num2

Parameters: The function accepts no parameter.

Return Value: It returns true if both numbers are equal, else it returns false

Example 1:




# Ruby program for == method in Integer 
    
# Initialize numbers 
num1 = 2
num2 = 3 
  
# Prints equal or not 
print num1 == num2

Output:

false

Example 2:




# Ruby program for == method in Integer 
    
# Initialize numbers 
num1 = 5
num2 = 5
  
# Prints equal or not
print num1 == num2

Output:

true
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!