diff options
Diffstat (limited to 'variables/src/main.rs')
-rw-r--r-- | variables/src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/variables/src/main.rs b/variables/src/main.rs new file mode 100644 index 0000000..3a4394a --- /dev/null +++ b/variables/src/main.rs @@ -0,0 +1,16 @@ +fn main() { + /* mutability */ + let mut x = 5; + println!("The variable of x is: {}", x); + x = 6; + println!("The variable of x is: {}", x); + + /* shadowing */ + let x = 5; + + let x = x + 1; + + let x = x * 2; + + println!("The value of x is: {}", x); +} |