Functions are the building blocks of Rust programs. Let's master them!
->fn function_name(param1: Type1, param2: Type2) -> ReturnType {
// function body
}This is crucial! In Rust:
fn add(a: i32, b: i32) -> i32 {
a + b // expression - no semicolon, this is returned
}
fn add_with_return(a: i32, b: i32) -> i32 {
return a + b; // explicit return (less idiomatic)
}Convert Celsius to Fahrenheit using the formula: $F = C \times \frac95 + 32$
f64 (floating point) parameterf64100.0°C should return 212.0°F9.0 / 5.0 for float division