mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 21:29:18 +00:00
quiz1&2
This commit is contained in:
parent
8d9a1461d3
commit
7c2e0d575d
@ -10,10 +10,14 @@
|
||||
// Write a function that calculates the price of an order of apples given
|
||||
// the quantity bought. No hints this time!
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
// Put your function here!
|
||||
// fn calculate_price_of_apples {
|
||||
fn calculate_price_of_apples(price: u32)-> u32 {
|
||||
if price > 40{
|
||||
return price;
|
||||
} else {
|
||||
price*2
|
||||
}
|
||||
}
|
||||
|
||||
// Don't modify this function!
|
||||
#[test]
|
||||
|
||||
@ -30,9 +30,9 @@ mod my_module {
|
||||
use super::Command;
|
||||
|
||||
// TODO: Complete the function signature!
|
||||
pub fn transformer(input: ???) -> ??? {
|
||||
pub fn transformer(input: Vec = [Trim, "Hello"]) -> Vec {
|
||||
// TODO: Complete the output declaration!
|
||||
let mut output: ??? = vec![];
|
||||
let mut output: Vec = vec![];
|
||||
for (string, command) in input.iter() {
|
||||
// TODO: Complete the function body. You can do it!
|
||||
}
|
||||
@ -43,7 +43,7 @@ mod my_module {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
// TODO: What do we have to import to have `transformer` in scope?
|
||||
use ???;
|
||||
use vec![enum, ""];
|
||||
use super::Command;
|
||||
|
||||
#[test]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user