Last active
December 3, 2018 13:30
-
-
Save toshimasa-nanaki/21d5704a2c89b96b2f79555b0fdcd333 to your computer and use it in GitHub Desktop.
Rust ループ(for文)
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() { | |
//for(int i = 0; i < 10; i++)と同じ | |
for x in 0..10 { | |
println!("{}", x); | |
} | |
//何回目の繰り返しか知りたい場合は以下。 | |
for (index, value) in (5..10).enumerate() { | |
println!("index = {} and value = {}", index, value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment