My code is repeating

(upload://b30fQJwRRb17wOevdfyOmMGS9AA.png)jk_2

i cant figure out why this is repeating (The Question Do You want to Play Again)

Hello there, @Aarav_Bafna. Would you mind posting a code snippet of the want to play again function? Would be happy to help, I just need to see what’s going on behind the scenes to give a definitive answer.

@Aarav_Bafna I got this problem also, without seeing your code (like @jakeflynn said I cannot be sure.

I used the AskToPlayAgain in the while statement, however I neglected to remove it from the do loop, hence it runs through the do loop, asks the question, then hits the while statement and asks it again.
image

Remove the highlighted code, it will fix the problem. Additionally this is how I solved the challenge, it differs from Ben’s solution which I found interesting having to create an additional bool to check what was already known and just needs checking.

Regards,

Pete

Privacy & Terms