diff options
author | AlburIvan <albur.ivan@outlook.com> | 2018-10-28 03:00:26 -0400 |
---|---|---|
committer | AlburIvan <albur.ivan@outlook.com> | 2018-10-28 03:00:26 -0400 |
commit | df0a0fa2a6ea1b818e3c6aaa139f77fde41f0256 (patch) | |
tree | c912eebef5bf5bfd45d4c2b6c91f355157041de8 /rust.html.markdown | |
parent | 73b8cd9a39ab9b63dd5e2c1c123c363fd014753a (diff) | |
parent | 27fa7c50ce23def736a69711f827918acc726e37 (diff) |
Merge branch 'master' of github.com:adambard/learnxinyminutes-docs into matlab-es
Diffstat (limited to 'rust.html.markdown')
-rw-r--r-- | rust.html.markdown | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/rust.html.markdown b/rust.html.markdown index 6b75fa87..71bc16b5 100644 --- a/rust.html.markdown +++ b/rust.html.markdown @@ -41,6 +41,7 @@ Rust not only fast, but also easy and efficient to code in. // 1. Basics // /////////////// +#[allow(dead_code)] // Functions // `i32` is the type for 32-bit signed integers fn add2(x: i32, y: i32) -> i32 { @@ -48,6 +49,9 @@ fn add2(x: i32, y: i32) -> i32 { x + y } +#[allow(unused_variables)] +#[allow(unused_assignments)] +#[allow(dead_code)] // Main function fn main() { // Numbers // @@ -256,11 +260,16 @@ fn main() { // `while` loop while 1 == 1 { println!("The universe is operating normally."); + // break statement gets out of the while loop. + // It avoids useless iterations. + break } // Infinite loop loop { println!("Hello!"); + // break statement gets out of the loop + break } ///////////////////////////////// |