eat a raw onion in csharp

main.cs
using System;

public class Program {
    public static void Main() {
        Console.WriteLine("Do you want to eat the raw onion? (Y/N)");
        string userInput = Console.ReadLine();
        
        if (userInput.ToLower() == "y") {
            Console.WriteLine("Peel the onion and eat it like an apple. Enjoy!");
        } else {
            Console.WriteLine("Okay, maybe next time.");
        }
    }
}
412 chars
15 lines

This is a console application written in C# that prompts the user if they want to eat the raw onion. If the user enters "Y", the program will output instructions to peel the onion and eat it like an apple. If they enter anything else, the program will output a different message. The string manipulation tag is used because we're using the ToLower() method to compare the user's input without worrying about case sensitivity.

gistlibby LogSnag