Ruby | Complex == function
Complex#==() is a Complex class method which checks whether two complex values are equal.
Syntax: Complex.==()
Parameter: Complex values
Return: true – if a == b
else false
Example #1 :
a = Complex( 200 )
b = Complex(- 1 , 4 )
c = Complex( 'i' )
puts "Complex == form : #{a==b}\n\n"
puts "Complex == form : #{b==c}\n\n"
puts "Complex == form : #{c==a}\n\n"
|
Output :
Complex == form : false
Complex == form : false
Complex == form : false
Example #2 :
a = Complex( 20 , 90 )
b = Complex( 'i' )
c = Complex( 100 , - 500 )
puts "Complex == form : #{a==b}\n\n"
puts "Complex == form : #{b==c}\n\n"
puts "Complex == form : #{a==a}\n\n"
|
Output :
Complex == form : false
Complex == form : false
Complex == form : true
Last Updated :
07 Jan, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...