diff options
Diffstat (limited to 'exercises/variables/variables3.rs')
| -rwxr-xr-x | exercises/variables/variables3.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/exercises/variables/variables3.rs b/exercises/variables/variables3.rs new file mode 100755 index 0000000..165a277 --- /dev/null +++ b/exercises/variables/variables3.rs @@ -0,0 +1,43 @@ +// variables3.rs +// Make me compile! Scroll down for hints :) + +fn main() { + let x = 3; + println!("Number {}", x); + x = 5; + println!("Number {}", x); +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// In Rust, variable bindings are immutable by default. But here we're trying +// to reassign a different value to x! There's a keyword we can use to make +// a variable binding mutable instead. |
