diff --git a/loops/src/main.rs b/loops/src/main.rs index f1692e4..ae00f43 100644 --- a/loops/src/main.rs +++ b/loops/src/main.rs @@ -1,5 +1,13 @@ fn main() { - loop { - println!("again!"); - } -} + let mut counter = 0; + + let result = loop { + counter += 1; + + if counter == 10 { + break counter * 2; + } + }; + + println!("The result is {result}"); +} \ No newline at end of file