Core Beginner
01 Functions
Implement small functions. The final expression in a block, written without a semicolon, is the value the function returns.
Implement square so it returns n * n.
Hints
fn name(arg: Type) -> RetType { ... }.- No
returnneeded -- leave the last line without a semicolon.
Reveal solution
fn square(n: i32) -> i32 {
n * n
}