Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd9290b

Browse files
committed
declare variables inside loop when needed
1 parent638994a commitcd9290b

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
usingSystem;
22

3-
intplayerRandomNum;
4-
intrivalRandomNum;
5-
63
intplayerPoints=0;
74
intrivalPoints=0;
85

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

1512
Console.ReadKey();
1613

17-
playerRandomNum=random.Next(1,7);
14+
intplayerRandomNum=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+
intrivalRandomNum=random.Next(1,7);
2421
Console.WriteLine("Rival rolled a "+rivalRandomNum);
2522

2623
if(playerRandomNum>rivalRandomNum)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp