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 it returns false.

Example 1:




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


Output:

true

Example 2:




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


Output:

false

Contact Us