5.1 Ask for a Number

In the next step:

๐Ÿ’ป C#

// Player enters a number between 1 and 2.

Like we did with the player choice, we need to ask the player to choose a number and store it in a variable.

Weโ€™ll use this value to calculate the total sum and determine the round winner.


โœ… What to Do

๐ŸŽฏ Expected Outcome

+--------------------------------+
+-- Welcome to Odds and Evens! --+
+--------------------------------+


--> Choose 1 for Odds or 2 for Evens:
1

# You chose Odds, Computer is Evens

--> Choose a number between 1 and 2:
1

๐Ÿ™ˆ Solution
Tried, you must, before reveal the solution you may. - Yoda

โœ๏ธ Program.cs - Changes

    // Player enters a number between 1 and 2.
++  GamePrint.Input("Choose a number between 1 and 2");
++  int playerNumber = GameInput.Number(1, 2);

๐Ÿ—’๏ธ Program.cs - Final

(...)

// Player enters a number between 1 and 2.
GamePrint.Input("Choose a number between 1 and 2");
int playerNumber = GameInput.Number(1, 2);

(...)