1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-06-15 00:04:58 +02:00

Add solutions to functions

This commit is contained in:
mo8it
2024-05-21 02:43:18 +02:00
parent 0f4c42d54e
commit d0b843d6c4
13 changed files with 97 additions and 41 deletions

View File

@ -1,8 +1,9 @@
fn main() {
let answer = square(3);
println!("The square of 3 is {}", answer);
}
// TODO: Fix the function body without chaning the signature.
fn square(num: i32) -> i32 {
num * num;
}
fn main() {
let answer = square(3);
println!("The square of 3 is {answer}");
}