Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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].