Skip to content

Commit bb8945a

Browse files
authored
Merge pull request #181 from puripuri2100/update-code-ch02-00
ch02-00のコードと説明文をupdateしました
2 parents f7cfe75 + bbabe5e commit bb8945a

File tree

30 files changed

+477
-649
lines changed

30 files changed

+477
-649
lines changed

listings/ch02-guessing-game-tutorial/listing-02-01/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[package]
22
name = "guessing_game"
33
version = "0.1.0"
4-
authors = ["Your Name <you@example.com>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
87

listings/ch02-guessing-game-tutorial/listing-02-01/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use std::io;
77
fn main() {
88
// ANCHOR_END: main
99
// ANCHOR: print
10-
println!("Guess the number!");
10+
println!("Guess the number!"); // 数を当ててごらん
1111

12-
println!("Please input your guess.");
12+
println!("Please input your guess."); // ほら、予想を入力してね
1313
// ANCHOR_END: print
1414

1515
// ANCHOR: string
@@ -21,11 +21,11 @@ fn main() {
2121
.read_line(&mut guess)
2222
// ANCHOR_END: read
2323
// ANCHOR: expect
24-
.expect("Failed to read line");
24+
.expect("Failed to read line"); // 行の読み込みに失敗しました
2525
// ANCHOR_END: expect
2626

2727
// ANCHOR: print_guess
28-
println!("You guessed: {}", guess);
28+
println!("You guessed: {}", guess); // 次のように予想しました: {}
2929
// ANCHOR_END: print_guess
3030
}
3131
// ANCHOR: all

listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.lock

Lines changed: 41 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[package]
22
name = "guessing_game"
33
version = "0.1.0"
4-
authors = ["Your Name <you@example.com>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
87

98
[dependencies]
10-
rand = "0.5.5"
9+
rand = "0.8.3"

listings/ch02-guessing-game-tutorial/listing-02-03/Cargo.lock

Lines changed: 41 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[package]
22
name = "guessing_game"
33
version = "0.1.0"
4-
authors = ["Your Name <you@example.com>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
87

98
[dependencies]
10-
rand = "0.5.5"
9+
rand = "0.8.3"

listings/ch02-guessing-game-tutorial/listing-02-03/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ fn main() {
88
println!("Guess the number!");
99

1010
// ANCHOR: ch07-04
11-
let secret_number = rand::thread_rng().gen_range(1, 101);
11+
let secret_number = rand::thread_rng().gen_range(1..101);
1212
// ANCHOR_END: ch07-04
1313

14-
println!("The secret number is: {}", secret_number);
14+
println!("The secret number is: {}", secret_number); //秘密の数字は次の通り: {}
1515

1616
println!("Please input your guess.");
1717

0 commit comments

Comments
 (0)