solutions for variables
This commit is contained in:
parent
84461c20cb
commit
816d8a32ad
exercises/variables
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 = 12;
|
||||
if x == 10 {
|
||||
println!("Ten!");
|
||||
} else {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
fn main() {
|
||||
let x: i32;
|
||||
x = 12;
|
||||
println!("Number {}", x);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue