Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn do_work(mut _n: u32) {
- // u32, makes a copy of the value of _n
- _n += 5;
- }
- fn main() {
- 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()
- do_work(x);
- println!("{}", x);
- }
Add Comment
Please, Sign In to add comment