mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-12-05 23:08:14 +02:00
Add solutions to functions
This commit is contained in:
@@ -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}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user