Skip to content
Snippets Groups Projects
Select Git revision
  • b47e562abaa2d0e055d47d4c7162d9cbf5af8d43
  • master default protected
2 results

call3.rs

Blame
  • call3.rs 192 B
    fn f(mut x: i32, mut y: i32) -> i32 {
        x = x + 1; // mutable paramer
        x + y
    }
    
    fn main() -> i32 {
        let a = 1;
        let b = 2;
        f(a, a + b) + a // call by value, a does not change
    }