Defining and Calling Functions
Functions in Rust are declared using the fn keyword. They help organize code into reusable blocks.
Function Syntax
fn greet() {
println!("Hello from a function!");
}Calling a function:
greet();Functions with Parameters
fn greet(name: &str) {
println!("Hello, {}!", name);
}
greet("Harshal");