What's the answer to life?

Just gonna paste a snippet of my code here as I’m “cheating” as I got a bit farther ahead, but going backwards and filling in the challenges of sharing with the community (in person I’m an extrovert, but when it comes to online stuff (forums & such) I’m introverted! Finally forced myself to share though.

Here’s my code snippet with my Easter Egg:

void RunMainMenu(string input)
    {
        bool isValidLevelNumber = (input == "1" || input == "2");

if (isValidLevelNumber)
        {
            level = int.Parse(input);
            AskForPassword();
        }
        
        else if (input == "42")
        {
            Terminal.WriteLine("Ah yes, the answer to life, but not the response I was looking for.");
            Terminal.WriteLine("Please choose a valid option.");            
        }

        else
        {
            Terminal.WriteLine("Please choose a valid option.");
        }
2 Likes

Privacy & Terms