fix: worked till functions

This commit is contained in:
Raghu Ganapathy 2023-07-15 22:03:41 -07:00
parent 593780df6b
commit 59e0adb455
5 changed files with 8 additions and 11 deletions

View File

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

View File

@ -1,13 +1,11 @@
// functions2.rs
// 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

@ -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) {

View File

@ -7,14 +7,12 @@
// 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;
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

@ -1,7 +1,7 @@
// 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 +9,5 @@ fn main() {
}
fn square(num: i32) -> i32 {
num * num;
return num * num;
}