First quiz done

This commit is contained in:
Shaja 2024-07-08 16:01:38 +05:30
parent ba0854d324
commit 6f0202719d
3 changed files with 10 additions and 8 deletions

View File

@ -2,17 +2,15 @@
//
// Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
pub fn animal_habitat(animal: &str) -> &'static str {
let identifier = if animal == "crab" {
1
} else if animal == "gopher" {
2.0
2
} else if animal == "snake" {
3
} else {
"Unknown"
4
};
// DO NOT CHANGE THIS STATEMENT BELOW

View File

@ -13,7 +13,7 @@ fn main() {
println!("Good morning!");
}
let // Finish the rest of this line like the example! Or make it be false!
let is_evening = true; // Finish the rest of this line like the example! Or make it be false!
if is_evening {
println!("Good evening!");
}

View File

@ -13,10 +13,14 @@
//
// No hints this time ;)
// I AM NOT DONE
// Put your function here!
// fn calculate_price_of_apples {
fn calculate_price_of_apples(quantity: i32) -> i32 {
return if quantity <= 40 {
quantity * 2
} else {
quantity * 1
}
}
// Don't modify this function!
#[test]