My Do While Solution is wrong whats my codes problem?

Pardon me for Bad English

but i came up a solution calling the function value and compare it with true or false now somehow its still always goes to infinite loop even though i set a statement. this bare in mind i sort of give my self a challenge to do the coding my way so the function of the play again its different a bit but pls if you guys can point where i did wrong it would be really helpful

The Problem of the looping

The play again function
Captureighig

Hi, at first glance I see two things that you can edit on your code:
1 - you have the AskToPlayAgain method inside the do-while loop, I think that is causing to be called twice per loop, its enough to leave it inside the while condition
2 - inside the AskToPlayAgain method, I suggest to change the if condition to: (Response[0] == ‘y’ || Response[0] == ‘Y’), its better to be as explicit as we can to get the expected behavior of our code.

Hope this helps you to solve your issue.

Privacy & Terms