First commit during exercises

This commit is contained in:
Shaja 2024-07-05 12:16:43 +05:30
parent 8d0aa11a35
commit ba0854d324
59 changed files with 29 additions and 33 deletions

View File

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

View File

@ -5,8 +5,6 @@
// 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,7 @@
// 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,9 @@
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let x;
let x: i32 = 10;
if x == 10 {
println!("x is ten!");
} else {

View File

@ -3,9 +3,7 @@
// 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 = 56;
println!("Number {}", x);
}

View File

@ -3,10 +3,9 @@
// 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: i32 = 3;
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x);

View File

@ -3,11 +3,10 @@
// 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: i32 = 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: i8 = 3;
fn main() {
println!("Number {}", NUMBER);
}

View File

@ -3,8 +3,12 @@
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
call_me();
}
fn call_me() {
println!("Hello");
}

View File

@ -3,14 +3,14 @@
// 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:i32) {
for i in 0..num {
println!("Ring! Call number {}", i + 1);
println!("Ring! Call number {}", i+1);
}
}

View File

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

View File

@ -8,14 +8,13 @@
// 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,13 +2,17 @@
//
// 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 {
// Complete this function to return the bigger number!
// Do not use:
// - another function call
// - additional variables
if a > b {
a
} else {
b
}
}
// Don't mind this for now :)

View File

@ -5,13 +5,14 @@
//
// Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
pub fn foo_if_fizz(fizzish: &str) -> &str {
if fizzish == "fizz" {
"foo"
} else if fizzish == "fuzz" {
"bar"
} else {
1
"baz"
}
}

0
rmeta0ryf3V/lib.rmeta Normal file
View File

0
rmeta2aSc3x/lib.rmeta Normal file
View File

0
rmeta33i6If/lib.rmeta Normal file
View File

0
rmeta5Wxz3U/lib.rmeta Normal file
View File

0
rmeta6SLzTY/lib.rmeta Normal file
View File

0
rmeta6d4cEP/lib.rmeta Normal file
View File

0
rmeta6ydyc4/lib.rmeta Normal file
View File

0
rmeta7BJqFE/lib.rmeta Normal file
View File

0
rmetaADFDqC/lib.rmeta Normal file
View File

0
rmetaC5KoMd/lib.rmeta Normal file
View File

0
rmetaCZBhUm/lib.rmeta Normal file
View File

0
rmetaG8ggMd/lib.rmeta Normal file
View File

0
rmetaI9CfM1/lib.rmeta Normal file
View File

0
rmetaJdmzg3/lib.rmeta Normal file
View File

0
rmetaL1loEt/lib.rmeta Normal file
View File

0
rmetaLqB2Pt/lib.rmeta Normal file
View File

0
rmetaMILKnS/lib.rmeta Normal file
View File

0
rmetaOLfFya/lib.rmeta Normal file
View File

0
rmetaOUjPNE/lib.rmeta Normal file
View File

0
rmetaSWrvVl/lib.rmeta Normal file
View File

0
rmetaUuliaM/lib.rmeta Normal file
View File

0
rmetaVBOY8B/lib.rmeta Normal file
View File

0
rmetaVYqrhZ/lib.rmeta Normal file
View File

0
rmetaVYslhO/lib.rmeta Normal file
View File

0
rmetaWPqumJ/lib.rmeta Normal file
View File

0
rmetaXAwDJn/lib.rmeta Normal file
View File

0
rmetaaRaIoY/lib.rmeta Normal file
View File

0
rmetaasPVKX/lib.rmeta Normal file
View File

0
rmetabDKu8I/lib.rmeta Normal file
View File

0
rmetacxdTWN/lib.rmeta Normal file
View File

0
rmetaetiEOc/lib.rmeta Normal file
View File

0
rmetafBXx3N/lib.rmeta Normal file
View File

0
rmetahurnUg/lib.rmeta Normal file
View File

0
rmetamn1kMA/lib.rmeta Normal file
View File

0
rmetan35lXf/lib.rmeta Normal file
View File

0
rmetancNxZE/lib.rmeta Normal file
View File

0
rmetanuq7Cb/lib.rmeta Normal file
View File

0
rmetanwtydK/lib.rmeta Normal file
View File

0
rmetaqrY8vE/lib.rmeta Normal file
View File

0
rmetas4kYOR/lib.rmeta Normal file
View File

0
rmetayvCQVv/lib.rmeta Normal file
View File

0
rmetazA76Xs/lib.rmeta Normal file
View File

0
rmetazTHYWp/lib.rmeta Normal file
View File

0
rmetazkI4QF/lib.rmeta Normal file
View File