1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-21 08:19:32 +02:00
Files
.github
mdbook-exerciser
po
src
theme
third_party
cxx
mdbook
rust-by-example
LICENSE-APACHE
LICENSE-MIT
README.md
destructuring-arrays.rs
destructuring-structs.rs
match-guards.rs
webevent.rs
rust-on-exercism
.gitignore
CONTRIBUTING.md
Cargo.lock
Cargo.toml
LICENSE
README.md
STYLE.md
TRANSLATIONS.md
aspect-ratio-helper.py
book.toml
dprint.json
language-picker.css
rustfmt.toml
speaker-notes.css
speaker-notes.js
svgbob.css
comprehensive-rust/third_party/rust-by-example/destructuring-arrays.rs

11 lines
325 B
Rust
Raw Normal View History

2022-12-21 16:36:30 +01:00
#[rustfmt::skip]
fn main() {
let triple = [0, -2, 3];
println!("Tell me about {triple:?}");
match triple {
[0, y, z] => println!("First is 0, y = {y}, and z = {z}"),
[1, ..] => println!("First is 1 and the rest were ignored"),
_ => println!("All elements were ignored"),
}
}