Skip to content

Instantly share code, notes, and snippets.

@toshimasa-nanaki
Created December 3, 2018 13:39
Show Gist options
  • Save toshimasa-nanaki/33a535d931ec811e068860a7d9eb3427 to your computer and use it in GitHub Desktop.
Save toshimasa-nanaki/33a535d931ec811e068860a7d9eb3427 to your computer and use it in GitHub Desktop.
Rust ループ(break文、continue文)
fn main() {
//break文が使える。
let mut x = 7;
loop {
x -= 1;
println!("{}", x);
if x == 3 { break; }
}
//continue文が使える。
for y in 0..10 {
if y % 2 == 0 { continue; }
println!("{}", y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment