C# if else user input handling issue : <p>I'm building a simple console based monster battling game for training purposes. </p>

<p>I've created a while loop which is almost where I need it to be but when the user enters an incorrect choice, the final "incorrect input" type message just loops infinitely on the screen.</p>

<p>Could somebody suggest a fix please?</p>

<p>Or, should I use a try, catch exception handler instead (I'm not very good at those yet).</p>

<p>Thank you,</p>

<p>code follows:</p>

<p>P.S The variable boolean acceptInput is initialized at the top of the class which is not included in this code segment.</p>

<pre><code> while (!acceptInput)
                    {
                    if (playerChoice == "a" || playerChoice == "h")
                    {
                        if (playerChoice == "a")
                        {
                            player.PlayerAttack();
                            if (random.NextDouble() &gt; .9)
                            {
                                Console.WriteLine("You missed!");
                                Console.WriteLine("Press ENTER to continue");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("It's a hit!");
                                monster.MonsterDecreaseHealth(player.AttackPower);
                                Console.WriteLine("Press ENTER to continue");
                                Console.ReadLine();
                            }
                            acceptInput = true;
                        }
                        else if (playerChoice == "h")
                        {
                            player.PlayerHeal();
                            acceptInput = true;
                        }
                    }
                    else
                    {
                        Console.WriteLine("That is not a valid choice, please enter either A or H");
                    }
                    }
</code></pre>
