Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exercises/01_intro/00_welcome/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// You can also find solutions to all exercises in the `solutions` git branch.
fn greeting() -> &'static str {
// TODO: fix me 👇
"I'm ready to __!"
"I'm ready to learn Rust!"
}

// Your solutions will be automatically verified by a set of tests.
Expand Down
2 changes: 1 addition & 1 deletion exercises/01_intro/01_syntax/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// partner in this course and it'll often guide you in the right direction!
//
// The input parameters should have the same type of the return type.
fn compute(a, b) -> u32 {
fn compute(a: u32, b: u32) -> u32 {
// Don't touch the function body.
a + b * 2
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/02_basic_calculator/00_intro/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn intro() -> &'static str {
// TODO: fix me 👇
"I'm ready to __!"
"I'm ready to build a calculator in Rust!"
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion exercises/02_basic_calculator/01_integers/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn compute(a: u32, b: u32) -> u32 {
// TODO: change the line below to fix the compiler error and make the tests pass.
let multiplier: u8 = 4;
let multiplier: u32 = 4;
a + b * multiplier
}

Expand Down
1 change: 1 addition & 0 deletions exercises/02_basic_calculator/02_variables/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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
// Do you need to annotate the type of `distance`? Why or why not?
let distance: u32 = end - start;

// Don't change the line below
distance / time_elapsed
Expand Down
10 changes: 9 additions & 1 deletion exercises/02_basic_calculator/03_if_else/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
/// `13` if `n` is divisible by `3`,
/// `17` otherwise.
fn magic_number(n: u32) -> u32 {
todo!()
if n % 2 == 0 {
return 12;
}

if n % 3 == 0 {
return 13;
}

17
}

#[cfg(test)]
Expand Down