Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#β€’8mo agoβ€’
8 replies
alek πŸ₯€

How can I make my program run a bool again? weird bug

Im making a simple 5 way Rock paper scissors game and at the end i have a line that goes

                Console.Write("Would you like to play again (Y/N): ");
                Console.Write("Would you like to play again (Y/N): ");

                answer = Console.ReadLine();
                answer = Console.ReadLine();

                answer = answer.ToUpper();
                answer = answer.ToUpper();


                if (answer == "Y")
                if (answer == "Y")

                {
                {

                    playAgain = true;
                    playAgain = true;

                }
                }

                else
                else

                {
                {

                    playAgain = false;
                    playAgain = false;

                }
                }


            }
            }

And after this i wanted it so that when the player types in anything else, it brings them to this:

            Console.WriteLine("Thanks for playing!");
            Console.WriteLine("Thanks for playing!");

            Console.WriteLine("Just write 'Y' to play again!");
            Console.WriteLine("Just write 'Y' to play again!");

            answer1 = Console.ReadLine();
            answer1 = Console.ReadLine();

            answer1 = answer1.ToUpper();
            answer1 = answer1.ToUpper();


            if (answer1 == "Y")
            if (answer1 == "Y")

            {
            {

                playAgain = true;
                playAgain = true;

            }
            }

            else
            else

            { playAgain = false;
            { playAgain = false;

            }
            }

                Console.ReadKey();
                Console.ReadKey();

        }
        }

    }
    }

}
}

But whenever i put in Y or y it just ends the program.
I believe the error to be something with the first part with the if and else statement or my coding is just bad.
I want it to just on that last cw where its to play again after the thanks for playing that it brings me back to my bool which is the second image
I have no idea what im doing im new to c# so for now i removed it but id like to get it fixed thank you!!!
image.png
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Making program run again
C#CC# / help
8mo ago
how do I make a program?
C#CC# / help
3y ago
βœ… My program can’t be run.
C#CC# / help
16mo ago
❔ How do i run a c# program
C#CC# / help
3y ago