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.