Finish a few exercises

This commit is contained in:
Jonathan Zernik 2022-06-04 20:49:22 -07:00
parent 9ec35d899c
commit 28967c8aff
8 changed files with 7 additions and 23 deletions

View File

@ -5,8 +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");
println!(r#" welcome to... "#);

View File

@ -2,8 +2,6 @@
// 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 {}!", "world");
}

View File

@ -2,9 +2,7 @@
// Make me compile!
// Execute the command `rustlings hint variables1` if you want a hint :)
// 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: i32 = 11;
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 = 7;
println!("Number {}", x);
}

View File

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