Rust Functions
Rust Functions
Functions are reusable blocks of code used to perform a specific task.
Functions help make programs:
- Cleaner
- Reusable
- Easy to understand
- Easy to maintain
In Rust, the main() function is the starting point of every program.
Video Explanation

Basic Function Syntax
Functions are created using the fn keyword.
Syntax
fn function_name() {
// code
}
Example
fn greet() {
println!("Welcome to Rust!");
}
fn main() {
greet();
}
Output
Welcome to Rust!
Function Parameters
Functions can accept values called parameters.
Parameters are written inside parentheses.