complete 02/[0,1,2]
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
fn intro() -> &'static str {
|
fn intro() -> &'static str {
|
||||||
// TODO: fix me 👇
|
// TODO: fix me 👇
|
||||||
"I'm ready to __!"
|
"I'm ready to build a calculator in Rust!"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
fn compute(a: u32, b: u32) -> u32 {
|
fn compute(a: u32, b: u32) -> u32 {
|
||||||
// TODO: change the line below to fix the compiler error and make the tests pass.
|
// TODO: change the line below to fix the compiler error and make the tests pass.
|
||||||
let multiplier: u8 = 4;
|
let multiplier: u8 = 4;
|
||||||
a + b * multiplier
|
a + b * multiplier as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
pub fn speed(start: u32, end: u32, time_elapsed: u32) -> u32 {
|
pub fn speed(start: u32, end: u32, time_elapsed: u32) -> u32 {
|
||||||
// TODO: define a variable named `distance` with the right value to get tests to pass
|
// TODO: define a variable named `distance` with the right value to get tests to pass
|
||||||
// Do you need to annotate the type of `distance`? Why or why not?
|
// Do you need to annotate the type of `distance`? Why or why not?
|
||||||
|
let distance = end - start;
|
||||||
// Don't change the line below
|
// Don't change the line below
|
||||||
distance / time_elapsed
|
distance / time_elapsed
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user