Beginner Ruby
Q17 / 100

Which loop construct repeats code a fixed number of times, e.g. 5 times?

Correct! Well done.

Incorrect.

The correct answer is A) 5.times do ... end

A

Correct Answer

5.times do ... end

Explanation

The Integer#times method, e.g. "5.times do |i| ... end", executes the block 5 times.

Progress
17/100