Created
April 13, 2014 03:27
-
-
Save deontologician/10567861 to your computer and use it in GitHub Desktop.
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 rows = [[ 1, 2, 3, 4], | |
[ 5, 6, 7, 8], | |
[ 9,10,11,12], | |
[13,14,15,16]]; | |
for i in range(0, 4u) { | |
for j in range(0, 3u) { | |
/// Here's what I'd like to do | |
if rows[i][j+1] == 0 { | |
rows[i][j+1] = rows[i][j]; | |
rows[i][j] = 0; | |
} | |
/// Is there a way to pull that out into a function called like: | |
combine(&mut rows[i][j], &mut rows[i][j+1]); | |
} | |
println!("\n------------"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment