Guest User

Untitled

a guest
Feb 16th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. fn do_work(mut _n: u32) {
  2. // u32, makes a copy of the value of _n
  3. _n += 5;
  4. }
  5.  
  6. fn main() {
  7. let mut x = 5; // read the warning, x doesn't need to be mut, this is because u32 will make a copy once inside do_work()
  8.  
  9. do_work(x);
  10.  
  11. println!("{}", x);
  12. }
Add Comment
Please, Sign In to add comment