Skip to content

Commit

Permalink
Merge pull request #223 from tiziano88/patch-1
Browse files Browse the repository at this point in the history
Clarify slice patterns example
  • Loading branch information
steveklabnik authored Nov 2, 2020
2 parents 7bc9b7a + 58830fc commit b91a9a8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rust-2018/slice-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn main() {
greet(&["Alan"]);
// output: Hey, there Alan! You seem to be alone.
greet(&["Joan", "Hugh"]);
// output: Hello, Joan and Hugh. Nice to see you are at least 2!
// output: Hello, Joan and Hugh. Nice to see you are exactly 2!
greet(&["John", "Peter", "Stewart"]);
// output: Hey everyone, we seem to be 3 here today.
}
Expand All @@ -25,7 +25,7 @@ fn greet(people: &[&str]) {
[] => println!("Bummer, there's no one here :("),
[only_one] => println!("Hey, there {}! You seem to be alone.", only_one),
[first, second] => println!(
"Hello, {} and {}. Nice to see you are at least 2!",
"Hello, {} and {}. Nice to see you are exactly 2!",
first, second
),
_ => println!("Hey everyone, we seem to be {} here today.", people.len()),
Expand Down Expand Up @@ -88,4 +88,4 @@ error[E0527]: pattern requires 4 elements but array has 3
[the tracking issue]: https://github.com/rust-lang/rust/issues/23121

When it comes to slice patterns, more advanced forms are planned but
have not been stabilized yet. To learn more, follow [the tracking issue].
have not been stabilized yet. To learn more, follow [the tracking issue].

0 comments on commit b91a9a8

Please sign in to comment.