Skip to content

Commit 86f0dcb

Browse files
committed
tutorial: Make example less bracey
1 parent afb3980 commit 86f0dcb

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

doc/tutorial.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import uint::range;
5353
import io::println;
5454
5555
fn main() {
56-
// Open a channel for receiving game results
56+
// Open a channel to receive game results
5757
do listen |result_from_game| {
5858
5959
let times = 10;
@@ -73,24 +73,24 @@ fn main() {
7373
let winner = result_from_game.recv();
7474
println(#fmt("%s wins round #%u", winner, round));
7575
}
76+
}
7677
77-
fn play_game(player1: str, player2: str) -> str {
78+
fn play_game(player1: str, player2: str) -> str {
7879
79-
// Our rock/paper/scissors types
80-
enum gesture {
81-
rock, paper, scissors
82-
}
80+
// Our rock/paper/scissors types
81+
enum gesture {
82+
rock, paper, scissors
83+
}
8384
84-
let rng = seeded_rng(seed());
85-
// A small inline function for picking an RPS gesture
86-
let pick = || [rock, paper, scissors][rng.gen_uint() % 3];
85+
let rng = seeded_rng(seed());
86+
// A small inline function for picking an RPS gesture
87+
let pick = || [rock, paper, scissors][rng.gen_uint() % 3];
8788
88-
// Pick two gestures and decide the result
89-
alt (pick(), pick()) {
90-
(rock, scissors) | (paper, rock) | (scissors, paper) { copy player1 }
91-
(scissors, rock) | (rock, paper) | (paper, scissors) { copy player2 }
92-
_ { "tie" }
93-
}
89+
// Pick two gestures and decide the result
90+
alt (pick(), pick()) {
91+
(rock, scissors) | (paper, rock) | (scissors, paper) { copy player1 }
92+
(scissors, rock) | (rock, paper) | (paper, scissors) { copy player2 }
93+
_ { "tie" }
9494
}
9595
}
9696
}

0 commit comments

Comments
 (0)