Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let x;
- {
- let n = 5;
- // Borrow n to y
- let y = &n;
- // Transfer the ownership from y to x
- x = y;
- } // n lives until here
- // n is no longer available.
- println!("{}", x);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement