-
-
Save vijairaj/74392a56b5e266404c38dc1b9739b433 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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 n = 0; | |
let val = loop { | |
if n == 0 { | |
break (1, "done"); | |
} | |
}; | |
println!("val: {:?}", val) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if n != 0
makes it an infinite loop, compiler validates if all paths return the same data type.