blob: ab999f3fe719e1aa80287fce8192294affcc8b0f (
plain) (
tree)
|
|
fn main() {
// let needle = 42; // <1>
let haystack = [1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862];
for reference in haystack.iter() {
let item = *reference;
let result = match item { // <2>
42 | 132 => "hit!", // <3>
_ => "miss", // <4>
};
if result == "hit!" {
println!("{}: {}", item, result);
}
}
}
|