mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-08 03:39:18 +00:00
fuctions done
This commit is contained in:
parent
8f79ae0571
commit
7250f5077a
@ -3,7 +3,7 @@
|
||||
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
// I AM DONE
|
||||
|
||||
fn main() {
|
||||
call_me(3);
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
// I AM DONE
|
||||
|
||||
fn main() {
|
||||
call_me();
|
||||
call_me(2);
|
||||
}
|
||||
|
||||
fn call_me(num: u32) {
|
||||
|
||||
@ -8,14 +8,14 @@
|
||||
// Execute `rustlings hint functions4` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
// I AM DONE
|
||||
|
||||
fn main() {
|
||||
let original_price = 51;
|
||||
println!("Your sale price is {}", sale_price(original_price));
|
||||
}
|
||||
|
||||
fn sale_price(price: i32) -> {
|
||||
fn sale_price(price: i32) -> i32 {
|
||||
if is_even(price) {
|
||||
price - 10
|
||||
} else {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
// I AM DONE
|
||||
|
||||
fn main() {
|
||||
let answer = square(3);
|
||||
@ -11,5 +11,5 @@ fn main() {
|
||||
}
|
||||
|
||||
fn square(num: i32) -> i32 {
|
||||
num * num;
|
||||
num * num
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user