first go at the exercises
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
// TODO: Add some function with the name `call_me` without arguments or a return value.
|
||||
|
||||
fn call_me()
|
||||
{
|
||||
println!("hoi");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
call_me(); // Don't change this line
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// TODO: Add the missing type of the argument `num` after the colon `:`.
|
||||
fn call_me(num:) {
|
||||
fn call_me(num: u32) {
|
||||
for i in 0..num {
|
||||
println!("Ring! Call number {}", i + 1);
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ fn call_me(num: u8) {
|
||||
|
||||
fn main() {
|
||||
// TODO: Fix the function call.
|
||||
call_me();
|
||||
call_me(255);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ fn is_even(num: i64) -> bool {
|
||||
}
|
||||
|
||||
// TODO: Fix the function signature.
|
||||
fn sale_price(price: i64) -> {
|
||||
fn sale_price(price: i64) -> i64{
|
||||
if is_even(price) {
|
||||
price - 10
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// TODO: Fix the function body without changing the signature.
|
||||
fn square(num: i32) -> i32 {
|
||||
num * num;
|
||||
num * num
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
Reference in New Issue
Block a user