Created
November 25, 2015 11:41
-
-
Save jorendorff/a9f4421f2e210776f345 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // variables are immutable by default | |
| fn main() { | |
| let x = 1; | |
| x = 2; // error: re-assignment of immutable variable `x` | |
| let nums = vec![1, 2, 3]; | |
| nums.push(4); // error: cannot borrow immutable local variable `nums` as mutable | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment