Question Detail

BIO 107 While Loops & Control Flow Objective Question

Question

In the anatomy of a while loop, what is the crucial role of the "# update variable" step?
Options
A To declare new variables for the loop.
B To display the current status of the loop.
C To prevent the loop from becoming an infinite loop.
Correct Answer
D To define the initial condition of the loop.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 4 explicitly states, "Update: Essential to prevent infinite loops!"

Hint

Consider what happens if a loop's condition never changes.

Question Info