SHARE
TWEET

Untitled

a guest Sep 12th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn f1() -> bool { true }
  2. fn f2() -> bool { false }
  3.  
  4. fn main() {
  5.     let mut v1 = 42;
  6.     let mut v2 = 666;
  7.  
  8.     let p1 = if f1() { &v1 } else { &v2 };
  9.  
  10.     if f2() {
  11.         let p2 = &mut v1;
  12.         *p2 = 37;
  13.         println!("p2: {}", *p2);
  14.     }
  15.    
  16.     println!("p1: {}", *p1);
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top