Basic Labeling - Rust
⚓ Rust 📅 2026-03-12 👤 surdeus 👁️ 5fn main() {
let s = [
[5, 6, 7],
[8, 9, 10],
[21, 15, 32]
];
let mut elements_searched = 0;
let target_value = 10;
'outer: for i in 0..=2 {
for j in 0..=2 {
elements_searched += 1;
if s[i][j] == target_value {
break 'outer;
}
}
}
println!("Elementos pesquisados: {elements_searched}");
}
Output:
Elementos pesquisados: 6
Errors:
Compiling playground v0.0.1 (/playground)
Finished `release` profile [optimized] target(s) in 0.47s
Running `target/release/playground`
1 post - 1 participant
🏷️ Rust_feed