What kind of loop should be used in a game where the user is guessing a secret code and the message "Guess again!" appears until the user guesses correctly?

(1 point)
• for loop.
• binary loop
• digital loop
• while loop

1 answer

In the scenario where the user is guessing a secret code and the message "Guess again!" appears until the user guesses correctly, the appropriate type of loop to use is a while loop.

A while loop continues to execute as long as a specified condition is true, which is suitable for repeatedly prompting the user for a guess until they provide the correct one.