Skip to content

Commit

Permalink
fixup! fixup! Merge pull request rust-lang#2158 from mnshdw/mnshdw/fe…
Browse files Browse the repository at this point in the history
…edback-errors6
  • Loading branch information
glpuga committed Nov 19, 2024
1 parent 95cfed1 commit 931431e
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 26 deletions.
1 change: 0 additions & 1 deletion .#README.md

This file was deleted.

7 changes: 7 additions & 0 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions exercises/00_intro/intro2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fn main() {
// TODO: Fix the code to print "Hello world!".
printline!("Hello world!");
println!("Hello world!");
}
3 changes: 1 addition & 2 deletions exercises/01_variables/variables1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
fn main() {
// TODO: Add the missing keyword.
x = 5;
let x = 5;

println!("x has the value {x}");
}
2 changes: 1 addition & 1 deletion exercises/01_variables/variables2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
// TODO: Change the line below to fix the compiler error.
let x;
let x : u32 = 0;

if x == 10 {
println!("x is ten!");
Expand Down
4 changes: 1 addition & 3 deletions exercises/01_variables/variables3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
fn main() {
// TODO: Change the line below to fix the compiler error.
let x: i32;

let x: i32 = 10;
println!("Number {x}");
}
3 changes: 1 addition & 2 deletions exercises/01_variables/variables4.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// TODO: Fix the compiler error.
fn main() {
let x = 3;
let mut x = 3;
println!("Number {x}");

x = 5; // Don't change this line
Expand Down
7 changes: 4 additions & 3 deletions exercises/01_variables/variables5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ fn main() {
let number = "T-H-R-E-E"; // Don't change this line
println!("Spell a number: {}", number);

// TODO: Fix the compiler error by changing the line below without renaming the variable.
number = 3;
println!("Number plus two is: {}", number + 2);
{
let number = 3;
println!("Number plus two is: {}", number + 2);
}
}
2 changes: 1 addition & 1 deletion exercises/01_variables/variables6.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// TODO: Change the line below to fix the compiler error.
const NUMBER = 3;
const NUMBER : i32 = 3;

fn main() {
println!("Number: {NUMBER}");
Expand Down
4 changes: 3 additions & 1 deletion exercises/02_functions/functions1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// TODO: Add some function with the name `call_me` without arguments or a return value.
fn call_me() {
println!("Please call me!");
}

fn main() {
call_me(); // Don't change this line
Expand Down
2 changes: 1 addition & 1 deletion exercises/02_functions/functions2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// TODO: Add the missing type of the argument `num` after the colon `:`.
fn call_me(num:) {
fn call_me(num: i32) {
for i in 0..num {
println!("Ring! Call number {}", i + 1);
}
Expand Down
3 changes: 1 addition & 2 deletions exercises/02_functions/functions3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ fn call_me(num: u8) {
}

fn main() {
// TODO: Fix the function call.
call_me();
call_me(8);
}
2 changes: 1 addition & 1 deletion exercises/02_functions/functions4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn is_even(num: i64) -> bool {
}

// TODO: Fix the function signature.
fn sale_price(price: i64) -> {
fn sale_price(price: i64) -> i64 {
if is_even(price) {
price - 10
} else {
Expand Down
2 changes: 1 addition & 1 deletion exercises/02_functions/functions5.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: Fix the function body without changing the signature.
fn square(num: i32) -> i32 {
num * num;
num * num
}

fn main() {
Expand Down
10 changes: 5 additions & 5 deletions exercises/03_if/if1.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fn bigger(a: i32, b: i32) -> i32 {
// TODO: Complete this function to return the bigger number!
// If both numbers are equal, any of them can be returned.
// Do not use:
// - another function call
// - additional variables
if a > b {
a
} else {
b
}
}

fn main() {
Expand Down

0 comments on commit 931431e

Please sign in to comment.