at exo 14

This commit is contained in:
Script_Kitty 2024-03-03 11:37:12 +00:00
parent 7c806e498a
commit 8594bab0d3
15 changed files with 36 additions and 29 deletions

View File

@ -13,8 +13,6 @@
// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a
// hint.
fg
fn main() {
println!("Hello and");
println!(r#" welcome to... "#);

View File

@ -5,8 +5,8 @@
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
printline!("Hello there!")
println!("Hello there!")
}

View File

@ -5,9 +5,9 @@
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
x = 5;
let x = 5;
println!("x has the value {}", x);
}

View File

@ -3,10 +3,10 @@
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let x;
let x = 10;
if x == 10 {
println!("x is ten!");
} else {

View File

@ -3,9 +3,9 @@
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let x: i32;
let x: i32 = 7;
println!("Number {}", x);
}

View File

@ -3,10 +3,10 @@
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let x = 3;
let mut x = 3;
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x);

View File

@ -3,11 +3,11 @@
// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let number = "T-H-R-E-E"; // don't change this line
println!("Spell a Number : {}", number);
number = 3; // don't rename this variable
let number = 3; // don't rename this variable
println!("Number plus two is : {}", number + 2);
}

View File

@ -3,9 +3,9 @@
// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
const NUMBER = 3;
const NUMBER : i32 = 3;
fn main() {
println!("Number {}", NUMBER);
}

View File

@ -3,7 +3,11 @@
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn call_me() {
}
fn main() {
call_me();

View File

@ -3,13 +3,13 @@
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
call_me(3);
}
fn call_me(num:) {
fn call_me(num: i32) {
for i in 0..num {
println!("Ring! Call number {}", i + 1);
}

View File

@ -3,10 +3,10 @@
// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
call_me();
call_me(32);
}
fn call_me(num: u32) {

View File

@ -8,14 +8,14 @@
// Execute `rustlings hint functions4` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let original_price = 51;
println!("Your sale price is {}", sale_price(original_price));
}
fn sale_price(price: i32) -> {
fn sale_price(price: i32) -> i32{
if is_even(price) {
price - 10
} else {

View File

@ -3,7 +3,7 @@
// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let answer = square(3);
@ -11,5 +11,5 @@ fn main() {
}
fn square(num: i32) -> i32 {
num * num;
num * num
}

View File

@ -2,9 +2,13 @@
//
// Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
pub fn bigger(a: i32, b: i32) -> i32 {
if a > b {
return a;
}
b
// Complete this function to return the bigger number!
// Do not use:
// - another function call

View File

@ -9,10 +9,11 @@
pub fn foo_if_fizz(fizzish: &str) -> &str {
if fizzish == "fizz" {
"foo"
} else {
1
return "foo";
} else if fizzish == "fuzz" {
return "bar";
}
"baz"
}
// No test changes needed!