How can I make these methods work? (C#)
I'm having problems with my code, specifically with methods. void Grid() { Console.WriteLine(" A B C"); Console.WriteLine("Z[{0}][{1}][{2}]", za, zb, zc); Console.WriteLine("X[{0}][{1}][{2}]", xa, xb, xc); Console.WriteLine("Y[{0}][{1}][{2}]", ya, yb, yc); } void Moves() { string move = Console.ReadLine(); switch (move.ToLower()) { case "za": case "az": za += 1; xa += 2; break; case "xa": case "ax": xa += 1; xb += 2; break; case "ya": case "ay": ya += 1; xa += 2; break; case "zb": case "bz": zb += 1; xb += 2; break; case "xb": case "bx": xb += 1; xc += 2; break; case "yb": case "by": yb += 1; xb += 2; break; case "zc": case "cz": zc += 1; xc += 2; break; case "xc": case "cx": xc += 1; xb += 2; break; case "yc": case "cy": yc += 1; yb += 2; break; default: Console.WriteLine("To make your move, type letter from right and letter from above the grid. E.g ZA"); break; } Grid(); Moves(); // Both of them work just fine without each other, like if I take Moves out, Grid will work and vice versa. If I try to run the code when they are used together, like I have em above, console just starts and closes immediately. What i'm doing wrong?