Created
December 29, 2014 16:51
-
-
Save MarkJr94/6583667479b3b56ffde4 to your computer and use it in GitHub Desktop.
problems with using static vars to initialize arrays
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
test.rs:4:22: 4:25 error: expected constant integer for repeat count, found variable | |
test.rs:4 let arr = [0i, ..FOO]; | |
^~~ | |
error: aborting due to previous error |
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
static FOO: uint = 32; | |
fn main() { | |
let arr = [0i, ..FOO]; | |
for n in arr.iter() { | |
println!("n: {}", n); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment