fn main() {
let side = 5.0;
let area = square_area(side);
println!("The area of the square is {}", area);
}
main.rs
This Rust code defines a function `square_area` that takes in the length of one side of a square and returns its area. It then demonstrates how to use this function by calculating the area of a square with a side length of 5 units. The output will print "The area of the square is 25".