finish variables section

This commit is contained in:
lukaszKielar 2020-06-21 20:24:19 +02:00
parent 55a9284665
commit bbd8245aa0
6 changed files with 9 additions and 19 deletions

View file

@ -6,9 +6,7 @@
// even after you already figured it out. If you got everything working and
// feel ready for the next exercise, remove the `I AM NOT DONE` comment below.
// I AM NOT DONE
fn main() {
x = 5;
let x = 5;
println!("x has the value {}", x);
}

View file

@ -1,10 +1,8 @@
// variables2.rs
// Make me compile! Execute the command `rustlings hint variables2` if you want a hint :)
// I AM NOT DONE
fn main() {
let x;
let x = 230;
if x == 10 {
println!("Ten!");
} else {

View file

@ -1,10 +1,8 @@
// variables3.rs
// Make me compile! Execute the command `rustlings hint variables3` if you want a hint :)
// I AM NOT DONE
fn main() {
let x = 3;
let mut x = 3;
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x);

View file

@ -1,9 +1,7 @@
// variables4.rs
// Make me compile! Execute the command `rustlings hint variables4` if you want a hint :)
// I AM NOT DONE
fn main() {
let x: i32;
let x: i32 = -5;
println!("Number {}", x);
}

View file

@ -1,11 +1,11 @@
// variables5.rs
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
// I AM NOT DONE
fn main() {
let number = "3"; // don't change this line
println!("Number {}", number);
number = 3;
println!("Number {}", number);
{
let number = &(33).to_string();
println!("Number {}", number);
}
}

View file

@ -1,9 +1,7 @@
// variables6.rs
// Make me compile! Execute the command `rustlings hint variables6` if you want a hint :)
// I AM NOT DONE
const NUMBER = 3;
const NUMBER: u8 = 3; // const's must be annotated
fn main() {
println!("Number {}", NUMBER);
}