Q:

(C#) Why am I getting the message "not all code paths return a value"

I'm new to C#, but decided to try and program something challenging. I decided to program a game of One Row Nim in which you play against a computer, where the computer always wins. I finished my code, and am getting the error "not all code paths return a value." I think I know what this means, but I'm not sure why I'm getting it.
using System;
    namespace OneRowNimThing {
    class NimSetup {
        static string OneRowNim(int count, int turn, int prevPlayerInput) {
        int playerInput, CPUInput, newCount;

        if (turn == 0) {
            if (count <= 0) {
                return "You Lose!";
            }
            else {
                Console.WriteLine("It is now your turn.");
                Console.WriteLine("Would you like to take 1, 2, or 3 pieces?");
                playerInput = Convert.ToInt32(Console.ReadLine());
                if (playerInput >= 4) {
                    Console.WriteLine("{0} is not a valid input.", playerInput);
                    OneRowNim(count, turn, prevPlayerInput);
                }
                else if (playerInput < 1) {
                    Console.WriteLine("{0} is not a valid input.", playerInput);
                    OneRowNim(count, turn, prevPlayerInput);
                }
                else {
                    newCount = count - playerInput;
                    Console.WriteLine("You have taken {0} pieces, there are {1} pieces remaining.", playerInput, newCount);
                    OneRowNim(newCount, 1, playerInput);
                }
            }
        }

        if (turn == 1) {
            if (count <= 0) {
                return "You Win!";
            }
            else {
                Console.WriteLine("It is now the computer's turn.");
                CPUInput = 4 - prevPlayerInput;
                newCount = count - CPUInput;
                Console.WriteLine("The computer took {0} pieces. There are {1} pieces remaining.", CPUInput, newCount);
                OneRowNim(newCount, 0, prevPlayerInput);
            }
        }
    }
    static void Main(string[] args) {
        OneRowNim(12, 0, 0);
    }
  }
}

If you don't know how Nim Works, it's essentially a game in which you take pieces out of a pile, and whoever takes the last one wins.

A:

You method signature states that it returns a string.
However, the if-else cases make the flow not always returning string.

turn == 0, count > 0, no return
turn == 1, count > 0, no return
turn > 1, no return

Make sure that your method returns something anyways.

