Answers for "rust currying, preset some arguments"

0

rust currying, preset some arguments

fn add(a: u32, b: u32) -> u32 {
    a + b
}

fn main() {
    // setting one of the parameters to a fixed value
    let add5 = move |x| add(5, x);
    println!("sample usage = {} ",add5(20));
}
Posted by: Guest on March-12-2021

Browse Popular Code Answers by Language