We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c97106 commit fbb4fb1Copy full SHA for fbb4fb1
exercises/02_basic_calculator/04_panics/src/lib.rs
@@ -2,6 +2,9 @@
2
/// calculate the average speed of the journey.
3
fn speed(start: u32, end: u32, time_elapsed: u32) -> u32 {
4
// TODO: Panic with a custom message if `time_elapsed` is 0
5
+ if time_elapsed == 0 {
6
+ panic!("The journey took no time at all. That's impossible!");
7
+ }
8
9
(end - start) / time_elapsed
10
}
0 commit comments