Open In App
Related Articles

Ruby | Integer == method

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
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

Last Updated : 06 Jan, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads