rustlings/exercises/functions/functions5.rs
2021-07-07 21:02:31 +01:00

18 lines
383 B
Rust

// functions5.rs
// Make me compile! Execute `rustlings hint functions5` for hints :)
fn main() {
let answer = square(3);
println!("The answer is {}", answer);
}
// without ; the expression is a return statement
// it can be either both num * num or
// return num * num;
// but it cannot be
// return num * num OR num * num;
fn square(num: i32) -> i32 {
num * num
}