红宝石 |整数 == 方法
==是 Ruby 中的一个内置方法,如果两个数字相等则返回 true,否则返回 false
Syntax: num1 == num2
Parameters: The function accepts no parameter.
Return Value: It returns true if both numbers are equal, else it returns false
示例 1 :
# Ruby program for == method in Integer
# Initialize numbers
num1 = 2
num2 = 3
# Prints equal or not
print num1 == num2
输出:
false
示例 2 :
# Ruby program for == method in Integer
# Initialize numbers
num1 = 5
num2 = 5
# Prints equal or not
print num1 == num2
输出:
true