The eql?()
function returns true
if both the source number and number
in the parameter are equal; otherwise, it returns false
.
Figure 1 shows a visual representation of the eql?()
function.
num_1.eql?(num_2)
# where num_1 is the number which is to be checked against the num_2 for equality
The eql?()
function takes another number, num_2
, to be compared with num_1
(number).
The eql?()
function returns true
if both the numbers are equal
; otherwise, it returns false
.
#equal numbersprint "(2).eql?(2) : ",(2).eql?(2) , "\n"print "(2.2).eql?(2.2) : ",(2.2).eql?(2.2) , "\n"#not equal numbersprint "(3).eql?(2) : ",(3).eql?(2) , "\n"print "(2.1).eql?(2.2) : ",(2.1).eql?(2.2) , "\n"