Search in a matrix
Rust Loops
labeled break 'rows
Flowchart (ISO 5807)
Source code
fn contains(m: &Vec<Vec<i32>>, key: i32) -> bool {
let mut found = false;
'rows: for row in m {
for &x in row {
if x == key {
found = true;
break 'rows;
}
}
}
found
}