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

Ruby support single inheritance/multiple inheritance or both?

1 Answers  


how many ways you can create a concatenating string?

1 Answers  


What is the difference between “#==” and “#equal?”

1 Answers  


Tell me what are blocks and procs?

1 Answers  


How to access Ruby strings elements in an application?

1 Answers  


Can you call a private method outside a ruby class using its object?

1 Answers  


Explain Ruby object?

1 Answers  


Name some operators used in ruby.

1 Answers  


What are advantages of using ruby?

1 Answers  


Where does a scope change in a ruby program?

1 Answers  


Tell me what is the difference between ruby 1.9 and ruby 2.0?

1 Answers  


mention what is the difference between a single quote and double quote?

1 Answers  


Categories