Created
December 1, 2022 15:00
-
-
Save RGGH/c25d09b556d89670e365d4910ded4663 to your computer and use it in GitHub Desktop.
Update a 2d array in Rust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut mar = [[1, 3, 5], [2, 4, 6], [7, 8, 9]]; | |
for row in mar.iter_mut() { | |
for num in row.iter_mut() { | |
*num += 5; | |
print!("{:?} ", num) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment