Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Loops-Nested/Rust/loops-nested.rust
Normal file
22
Task/Loops-Nested/Rust/loops-nested.rust
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use rand::Rng;
|
||||
|
||||
extern crate rand;
|
||||
|
||||
fn main() {
|
||||
let mut matrix = [[0u8; 10]; 10];
|
||||
let mut rng = rand::thread_rng();
|
||||
|
||||
for row in matrix.iter_mut() {
|
||||
for item in row.iter_mut() {
|
||||
*item = rng.gen_range(0, 21);
|
||||
}
|
||||
}
|
||||
|
||||
'outer: for row in matrix.iter() {
|
||||
for &item in row.iter() {
|
||||
print!("{:2} ", item);
|
||||
if item == 20 { break 'outer }
|
||||
}
|
||||
println!();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue