mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 13:19:18 +00:00
added(): test commit
This commit is contained in:
parent
ed18c3b93d
commit
b59f38da23
@ -4,13 +4,14 @@
|
||||
// Step 2: Get the bar_for_fuzz and default_to_baz tests passing!
|
||||
// Execute the command `rustlings hint if2` if you want a hint :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
pub fn fizz_if_foo(fizzish: &str) -> &str {
|
||||
if fizzish == "fizz" {
|
||||
"foo"
|
||||
} else if fizzish == "fuzz" {
|
||||
"bar"
|
||||
} else {
|
||||
1
|
||||
"baz"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,13 @@
|
||||
// I AM NOT DONE
|
||||
|
||||
// Put your function here!
|
||||
// fn calculate_apple_price {
|
||||
fn calculate_apple_price(quantity: i32) -> i32 {
|
||||
if quantity > 40 {
|
||||
return quantity;
|
||||
} else {
|
||||
return quantity * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't modify this function!
|
||||
#[test]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user