Intermediate Ruby
Q55 / 100

What is the purpose of "respond_to?" method?

Correct! Well done.

Incorrect.

The correct answer is A) To check if an object responds to (defines/inherits) a given method name

A

Correct Answer

To check if an object responds to (defines/inherits) a given method name

Explanation

respond_to?(:method_name) returns true if the object has a method with that name, often used to support duck typing checks.

Progress
55/100