Current progress

This commit is contained in:
2023-04-20 05:50:50 -05:00
parent 7f1754ecc5
commit 5004cc3bbb
49 changed files with 152 additions and 132 deletions
+4 -1
View File
@@ -1,8 +1,11 @@
// functions1.rs
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
fn main() {
call_me();
}
fn call_me() {
print!("Called");
}
+2 -3
View File
@@ -1,13 +1,12 @@
// functions2.rs
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
fn main() {
call_me(3);
call_me(5);
}
fn call_me(num:) {
fn call_me(num: i16) {
for i in 0..num {
println!("Ring! Call number {}", i + 1);
}
+1 -2
View File
@@ -1,10 +1,9 @@
// functions3.rs
// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
fn main() {
call_me();
call_me(3);
}
fn call_me(num: u32) {
+4 -5
View File
@@ -7,21 +7,20 @@
// in the signatures for now. If anything, this is a good way to peek ahead
// to future exercises!)
// I AM NOT DONE
fn main() {
let original_price = 51;
let original_price: u32 = 51;
println!("Your sale price is {}", sale_price(original_price));
}
fn sale_price(price: i32) -> {
if is_even(price) {
fn sale_price(price: u32) -> u32 {
if (price % 2 == 0) {
price - 10
} else {
price - 3
}
}
fn is_even(num: i32) -> bool {
fn is_even(num: u32) -> bool {
num % 2 == 0
}
+1 -2
View File
@@ -1,7 +1,6 @@
// functions5.rs
// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
fn main() {
let answer = square(3);
@@ -9,5 +8,5 @@ fn main() {
}
fn square(num: i32) -> i32 {
num * num;
return num * num;
}