variables done

This commit is contained in:
Christopher Girvin 2022-05-14 16:21:32 -04:00
parent 75b09dd69a
commit b8d4133328
9 changed files with 8 additions and 14 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ exercises/clippy/Cargo.lock
.idea
.vscode
*.iml
rustlings/

View File

@ -5,7 +5,6 @@
// ready for the next exercise, remove the `I AM NOT DONE` comment below.
// Execute the command `rustlings hint intro1` for a hint.
// I AM NOT DONE
fn main() {
println!("Hello and");

View File

@ -2,8 +2,7 @@
// Make the code print a greeting to the world.
// Execute `rustlings hint intro2` for a hint.
// I AM NOT DONE
fn main() {
println!("Hello {}!");
println!("Hello {}!", word = String::from("world"));
}

View File

@ -2,9 +2,8 @@
// Make me compile!
// Execute the command `rustlings hint variables1` if you want a hint :)
// I AM NOT DONE
fn main() {
x = 5;
let x: i32 = 5;
println!("x has the value {}", x);
}

View File

@ -1,10 +1,9 @@
// 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: i32 = 4;
if x == 10 {
println!("Ten!");
} else {

View File

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

View File

@ -1,11 +1,10 @@
// variables5.rs
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
// I AM NOT DONE
fn main() {
let number = "T-H-R-E-E"; // don't change this line
println!("Spell a Number : {}", number);
number = 3;
let number = 3;
println!("Number plus two is : {}", number + 2);
}

View File

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