function
A named block of code you can call with arguments.
A function (fn) takes typed parameters and returns a value of its declared return type.
Loading interactive…
Examples
fn pay(hours: u32, rate: u32) -> u32 { hours * rate }called aspay(4, 15)returns 60.
See also