Rust - Functions

 Functions:


fn keyword used to define a function

fn main(){

}



fn do_stuff(a:i23, b:i32) -> i32 {

return a+b;

}


fn do_stuff(a:i23, b:i32) -> i32 {

        a+b  // this will return automatically

}


variable number of arguments won't support in rust but macros support variable number of arguments 

println! is macro.


Comments

Popular posts from this blog

BIOFLOC