Skip to content

Instantly share code, notes, and snippets.

@jcar787
Created April 8, 2022 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcar787/57ac063450a1fff8a1cc34ad7e1d35bd to your computer and use it in GitHub Desktop.
Save jcar787/57ac063450a1fff8a1cc34ad7e1d35bd to your computer and use it in GitHub Desktop.
Example of the loop loop in rust
fn main() {
let mut i = 0;
loop {
println!("Is this going to print for eternity?");
i += 1;
if i == 42 {
println!("Of course not. We have the answer");
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment