Fix variables exercises
This commit is contained in:
parent
f2c19c5237
commit
4d87bc8d58
exercises/variables
|
@ -1,10 +1,8 @@
|
||||||
// variables3.rs
|
// variables3.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables3` if you want a hint :)
|
// Make me compile! Execute the command `rustlings hint variables3` if you want a hint :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 3;
|
let mut x = 3;
|
||||||
println!("Number {}", x);
|
println!("Number {}", x);
|
||||||
x = 5; // don't change this line
|
x = 5; // don't change this line
|
||||||
println!("Number {}", x);
|
println!("Number {}", x);
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
// variables4.rs
|
// variables4.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables4` if you want a hint :)
|
// Make me compile! Execute the command `rustlings hint variables4` if you want a hint :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: i32;
|
let x: i32 = 0;
|
||||||
println!("Number {}", x);
|
println!("Number {}", x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
// variables5.rs
|
// variables5.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
|
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let number = "3"; // don't change this line
|
let number = "3"; // don't change this line
|
||||||
println!("Number {}", number);
|
println!("Number {}", number);
|
||||||
number = 3;
|
// Shadowing
|
||||||
|
let number = 3;
|
||||||
println!("Number {}", number);
|
println!("Number {}", number);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
// variables6.rs
|
// variables6.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables6` if you want a hint :)
|
// Make me compile! Execute the command `rustlings hint variables6` if you want a hint :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
const NUMBER: i32 = 3;
|
||||||
|
|
||||||
const NUMBER = 3;
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Number {}", NUMBER);
|
println!("Number {}", NUMBER);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue