Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Explain each of the following operators and how and when they should be used: ==, ===, eql?, Equal?



Explain each of the following operators and how and when they should be used: ==, ===, eql?, Equal?..

Answer / Bhavana Gautam

== is a comparison operator that checks if two objects are equal. It works for most object types but may not work correctly with custom objects or classes. === is a match operator that determines if an object matches the specified class or module. It's often used in conditional statements like `if obj == MyClass` or `if obj instanceof MyClass`. eql? is a method that returns true if two objects are equal and their types are the same. Equal? is another comparison method that checks for both equality and object identity (it only works with reference types like arrays, hashes, and classes).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ruby Interview Questions

Does hash use “ #==” or “#eql?” To compare hash keys?

1 Answers  


Tell me what is the difference between active support's “hashwithindifferent” and ruby's “hash” ?

1 Answers  


Tell me what are blocks and procs?

1 Answers  


What are the different uses of ruby modules?

1 Answers  


Tell me what is the difference between calling super and calling super()?

1 Answers  


Why Ruby is known as a language of flexibility?

1 Answers  


Where does a scope change in a ruby program?

1 Answers  


What are freezing string in Ruby?

1 Answers  


Explain about operators in Ruby?

1 Answers  


Explain ampersand parameter (&block) in Ruby?

1 Answers  


What are the data types in ruby?

1 Answers  


How to open a file in Ruby?

1 Answers  


Categories