-2
        Write("Hello, what is you name? ");
        customer = ReadLine();
        WriteLine($"Nice to meet you, {customer}. What kind of pizza would you like?");

        pizza = ReadLine();
        if (pizza == "Sausage")
        {
            WriteLine("Nice, that will be 20.00");
        }
        else if (pizza != "Sausage")
        {
            WriteLine("Make up your mind");
        }

//////////////////////How do I close in this instance? For answer is not sausage

  • I have code after this, but I only want that to appear if I input Sausage. If I don't input Sausage, I just want the console to close. How do I do this? – CastilloCaleb Jan 20 '18 at 02:54

1 Answers1

2

If you return from the Main method that will end the application. I have moved the code around a little bit to demonstrate this.

Console.Write("Hello, what is you name? ");
var customer = Console.ReadLine();
Console.WriteLine($"Nice to meet you, {customer}. What kind of pizza would you like?");

var pizza = Console.ReadLine();

if(pizza != "Sausage")
{
    Console.WriteLine("Make up your mind");
    return;
}
Console.WriteLine("Nice, that will be 20.00");
Andrew McC
  • 98
  • 1
  • 5
  • That works! Thank you. I am just picking up C# in my class. This my first semester and I just wanted to play around with what we learned. – CastilloCaleb Jan 20 '18 at 03:08