Intermediate Ruby
Q77 / 100

What is the purpose of "Array#each_with_index"?

Correct! Well done.

Incorrect.

The correct answer is B) It iterates over the array yielding both each element and its index to the block

B

Correct Answer

It iterates over the array yielding both each element and its index to the block

Explanation

each_with_index yields each element along with its zero-based index, useful when both the value and its position are needed.

Progress
77/100