Skip to content

Instantly share code, notes, and snippets.

@toshimasa-nanaki
Last active December 3, 2018 13:30
Show Gist options
  • Save toshimasa-nanaki/21d5704a2c89b96b2f79555b0fdcd333 to your computer and use it in GitHub Desktop.
Save toshimasa-nanaki/21d5704a2c89b96b2f79555b0fdcd333 to your computer and use it in GitHub Desktop.
Rust ループ(for文)
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