added(save): random save

This commit is contained in:
Tomasz Waszczyk 2022-06-10 17:39:11 +02:00
parent df4d738af7
commit ed18c3b93d
No known key found for this signature in database
GPG Key ID: 2D1E70DB13336E3A
5 changed files with 9 additions and 11 deletions

View File

@ -1,13 +1,12 @@
// functions2.rs
// Make me compile! Execute `rustlings hint functions2` for hints :)
// I AM NOT DONE
fn main() {
call_me(3);
}
fn call_me(num:) {
fn call_me(num: u32) {
for i in 0..num {
println!("Ring! Call number {}", i + 1);
}

View File

@ -1,10 +1,8 @@
// functions3.rs
// Make me compile! Execute `rustlings hint functions3` for hints :)
// I AM NOT DONE
fn main() {
call_me();
call_me(5);
}
fn call_me(num: u32) {

View File

@ -4,14 +4,13 @@
// This store is having a sale where if the price is an even number, you get
// 10 Rustbucks off, but if it's an odd number, it's 3 Rustbucks off.
// 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,13 +1,11 @@
// functions5.rs
// Make me compile! Execute `rustlings hint functions5` for hints :)
// I AM NOT DONE
fn main() {
let answer = square(3);
println!("The answer is {}", answer);
}
fn square(num: i32) -> i32 {
num * num;
return num * num;
}

View File

@ -1,8 +1,12 @@
// if1.rs
// I AM NOT DONE
pub fn bigger(a: i32, b: i32) -> i32 {
if a > b {
return a
} else {
return b;
}
// Complete this function to return the bigger number!
// Do not use:
// - another function call