I know it's something I'm doing wrong, but I can't seem to figure out what it is. The console reads the text you input and replies to what you have sent with a message set specifically for your input message. When I input "hello", it replied with "Hello! How are you? (Answers = good, bad)", but when I go to enter either "yes" or "no", the console closes without submitting the message I've specified. Can anybody help me out?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3 {
class TestClass1 {
static void Main() {
String UserInput = Console.ReadLine();
String PrevAnswer = null;
switch (PrevAnswer) {
case null: {
switch (UserInput) {
case "hello": {
Console.WriteLine("Hello! How are you? (Answers = good, bad)");
break;
}
case "goodbye": {
Environment.Exit(0);
break;
}
}
break;
}
case "hello": {
switch (UserInput) {
case "good": {
Console.WriteLine("That's good to hear");
Console.ReadLine();
break;
}
case "bad": {
Console.WriteLine("Oh, that's sad to hear :(");
break;
}
}
break;
}
}
Console.ReadLine();
}
}
}