add own edits to compile all 6 exercises

This commit is contained in:
Eri Mendz 2021-04-06 15:30:55 +03:00
parent a303d508cf
commit b1ed7aa800
6 changed files with 13 additions and 15 deletions

View file

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

View file

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

View file

@ -1,11 +1,12 @@
// 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);
println!("Then changed to ");
x = 5; // don't change this line x = 5; // don't change this line
println!("Number {}", x); println!("Number {}", x);
println!("Because of the keyword mut");
} }

View file

@ -1,9 +1,8 @@
// 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 = 90;
println!("Number {}", x); println!("Number {}", x);
} }

View file

@ -1,11 +1,11 @@
// 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 = "T-H-R-E-E"; let mut number = "T-H-R-E-E";
println!("Spell a Number : {}", number); println!("Spell a Number (string): {}", number);
number = 3; let number = 3;
println!("new number (type int) is : {}", number);
println!("Number plus two is : {}", number + 2); println!("Number plus two is : {}", number + 2);
} }

View file

@ -1,9 +1,9 @@
// 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 = 3; //const NUMBER: i32 = 3;
const NUMBER: i64 = 300;
fn main() { fn main() {
println!("Number {}", NUMBER); println!("Number {}", NUMBER);
} }