Intermediate Ruby
Q58 / 100

What is the purpose of keyword arguments in method definitions, e.g. "def greet(name:, greeting: 'Hello')"?

Correct! Well done.

Incorrect.

The correct answer is B) They allow arguments to be passed by name in any order, with optional default values for those not marked as required

B

Correct Answer

They allow arguments to be passed by name in any order, with optional default values for those not marked as required

Explanation

Keyword arguments let callers specify arguments by name (e.g. greet(name: "Bob")), improving readability and allowing any order, with defaults for optional ones.

Progress
58/100