Created
April 8, 2022 19:03
-
-
Save jcar787/57ac063450a1fff8a1cc34ad7e1d35bd to your computer and use it in GitHub Desktop.
Example of the loop loop in rust
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() { | |
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