Skip to content

Commit 278a1f1

Browse files
Original exercises
1 parent 1acbbb6 commit 278a1f1

27 files changed

+86
-57
lines changed

exercises/functions/functions1.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// functions1.rs
22
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a hint.
33

4+
// I AM NOT DONE
5+
46
fn main() {
57
call_me();
68
}
7-
8-
fn call_me() {
9-
println!("I'm Nidhal Messaoudi, a software developer going Rusty!!!");
10-
}

exercises/functions/functions2.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// functions2.rs
22
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a hint.
33

4+
// I AM NOT DONE
5+
46
fn main() {
57
call_me(3);
68
}
79

8-
fn call_me(num: i32) {
10+
fn call_me(num:) {
911
for i in 0..num {
1012
println!("Ring! Call number {}", i + 1);
1113
}

exercises/functions/functions3.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// functions3.rs
22
// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a hint.
33

4+
// I AM NOT DONE
5+
46
fn main() {
5-
call_me(12);
7+
call_me();
68
}
79

810
fn call_me(num: u32) {

exercises/functions/functions4.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
// in the signatures for now. If anything, this is a good way to peek ahead
88
// to future exercises!)
99

10+
// I AM NOT DONE
11+
1012
fn main() {
1113
let original_price = 51;
1214
println!("Your sale price is {}", sale_price(original_price));
1315
}
1416

15-
fn sale_price(price: i32) -> i32 {
17+
fn sale_price(price: i32) -> {
1618
if is_even(price) {
1719
price - 10
1820
} else {

exercises/functions/functions5.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// functions5.rs
22
// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a hint.
33

4+
// I AM NOT DONE
5+
46
fn main() {
57
let answer = square(3);
68
println!("The square of 3 is {}", answer);
79
}
810

911
fn square(num: i32) -> i32 {
10-
return num * num;
12+
num * num;
1113
}

exercises/if/if1.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// if1.rs
22
// Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint.
33

4+
// I AM NOT DONE
5+
46
pub fn bigger(a: i32, b: i32) -> i32 {
57
// Complete this function to return the bigger number!
68
// Do not use:
79
// - another function call
810
// - additional variables
9-
if a > b {
10-
a
11-
} else {
12-
b
13-
}
1411
}
1512

1613
// Don't mind this for now :)

exercises/if/if2.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
// Step 2: Get the bar_for_fuzz and default_to_baz tests passing!
55
// Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint.
66

7+
// I AM NOT DONE
8+
79
pub fn foo_if_fizz(fizzish: &str) -> &str {
8-
if fizzish == "fuzz" {
9-
"bar"
10-
} else if fizzish == "fizz" {
10+
if fizzish == "fizz" {
1111
"foo"
1212
} else {
13-
"baz"
13+
1
1414
}
1515
}
1616

exercises/intro/intro1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// when you change one of the lines below! Try adding a `println!` line, or try changing
1010
// what it outputs in your terminal. Try removing a semicolon and see what happens!
1111

12+
// I AM NOT DONE
13+
1214
fn main() {
1315
println!("Hello and");
1416
println!(r#" welcome to... "#);

exercises/intro/intro2.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Make the code print a greeting to the world.
33
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a hint.
44

5+
// I AM NOT DONE
6+
57
fn main() {
6-
println!("Hello {}!", "World");
8+
println!("Hello {}!");
79
}

exercises/move_semantics/move_semantics1.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// move_semantics1.rs
22
// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand for a hint.
33

4+
// I AM NOT DONE
5+
46
fn main() {
57
let vec0 = Vec::new();
68

7-
let mut vec1 = fill_vec(vec0);
9+
let vec1 = fill_vec(vec0);
810

911
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);
1012

0 commit comments

Comments
 (0)