CS0161 "Program.Calculate (string, int, int)": not all branches of the code return a value. ConsoleApp1 C: \ Users \ Denis \ source \ repos \ calculateoncsharp \ ConsoleApp1 \ Program.cs
public static int Calculate(string action1, int a2, int a1) { switch (action1){ case "pi": return a1 + a2; case "mi": return a1 - a2; case "mu": return a1 * a2; case "de": return a1 / a2; default: Console.WriteLine("Error"); break; } }
default, there will be no return if nocasehas fallen. Either enterreturnindefault, or at the end of the method. - Suvitruf ♦