Skip to content

Commit cd9290b

Browse files
committed
declare variables inside loop when needed
1 parent 638994a commit cd9290b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Projects/Dice Game/Program.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System;
22

3-
int playerRandomNum;
4-
int rivalRandomNum;
5-
63
int playerPoints = 0;
74
int rivalPoints = 0;
85

@@ -14,13 +11,13 @@
1411

1512
Console.ReadKey();
1613

17-
playerRandomNum = random.Next(1, 7);
14+
int playerRandomNum = random.Next(1, 7);
1815
Console.WriteLine("You rolled a " + playerRandomNum);
1916

2017
Console.WriteLine("....");
2118
System.Threading.Thread.Sleep(1000);
2219

23-
rivalRandomNum = random.Next(1, 7);
20+
int rivalRandomNum = random.Next(1, 7);
2421
Console.WriteLine("Rival rolled a " + rivalRandomNum);
2522

2623
if (playerRandomNum > rivalRandomNum)

0 commit comments

Comments
 (0)