Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created March 9, 2019 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/800c3da606753fee32f06bd5699cbef5 to your computer and use it in GitHub Desktop.
Save kunigami/800c3da606753fee32f06bd5699cbef5 to your computer and use it in GitHub Desktop.
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