Created
March 9, 2019 04:10
-
-
Save kunigami/800c3da606753fee32f06bd5699cbef5 to your computer and use it in GitHub Desktop.
This file contains 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
let mut vec1 = vec![1, 2, 3]; | |
{ | |
let vec2 = &mut vec1; | |
// We can mutate s1's data via a mutable reference! | |
vec2.push(4); | |
println!("{}", vec2.len()); | |
} | |
println!("{}", vec1.len()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment