fn main() {
   fn sum_vec (v: &Vec<i32>) -> i32 {
       return v.iter().fold(0, |a, &b| a + b);
   }

   fn foo (v1: &Vec<i32>, v2: &Vec<i32>) -> i32 


   fn foo1 (v: &Vec<i32>) {
       // v.push(5); // will cause error as not  a mutable reference
   }

   let v = vec![];

   foo1(&v);

   let v1 = vec![1, 2, 3];
   let v2 = vec![4, 5, 6];

   let answer = foo(&v1, &v2);
   println!("{}", answer);

   // mutable reference
   let mut x = 5;
   {
       let y = &mut x;
       *y += 1;
   }

   println!("{}", x);

   // thinking in scope
   let mut x2 = 5;
   
   {
       let y2 = &mut x2;
       *y2 += 1;
       // println!("{}", x); // not okay to be in the scope
   }

   println!("{}", x); // okay here as scope ended
}

{
       let s1 = sum_vec(v1);
       let s2 = sum_vec(v2);

       s1 + s2
   }