mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-12-28 06:49:19 +00:00
Merge 88086d6b9ce2ac47e5e73a4d698c3f7b757c6c56 into b5bbd7247a751cb7b2707d28246d9e57ab75634a
This commit is contained in:
commit
b842030887
@ -4,7 +4,9 @@ fn main() {
|
||||
call_me();
|
||||
}
|
||||
|
||||
|
||||
fn call_me() {
|
||||
println!("thank you for calling me :)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ 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);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Make me compile! Scroll down for hints :)
|
||||
|
||||
fn main() {
|
||||
call_me();
|
||||
call_me(5);
|
||||
}
|
||||
|
||||
fn call_me(num: i32) {
|
||||
|
||||
@ -8,7 +8,7 @@ fn main() {
|
||||
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 {
|
||||
|
||||
@ -6,7 +6,7 @@ fn main() {
|
||||
}
|
||||
|
||||
fn square(num: i32) -> i32 {
|
||||
num * num;
|
||||
num * num
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Make me compile! Scroll down for hints :)
|
||||
|
||||
fn main() {
|
||||
x = 5;
|
||||
let x = 5;
|
||||
println!("x has the value {}", x);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Make me compile! Scroll down for hints :)
|
||||
|
||||
fn main() {
|
||||
let x;
|
||||
let x = 10;
|
||||
if x == 10 {
|
||||
println!("Ten!");
|
||||
} else {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Make me compile! Scroll down for hints :)
|
||||
|
||||
fn main() {
|
||||
let x = 3;
|
||||
let mut x = 3;
|
||||
println!("Number {}", x);
|
||||
x = 5;
|
||||
println!("Number {}", x);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Make me compile! Scroll down for hints :)
|
||||
|
||||
fn main() {
|
||||
let x: i32;
|
||||
let x: i32 = 777;
|
||||
println!("Number {}", x);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user