fix(variables): reorder and redo hint texts

This commit is contained in:
mokou 2022-07-11 13:43:41 +02:00
parent c3c21ad91f
commit 81edc4234f
7 changed files with 20 additions and 20 deletions

View File

@ -1,6 +1,6 @@
// variables1.rs // variables1.rs
// Make me compile! // Make me compile!
// Execute the command `rustlings hint variables1` if you want a hint :) // Execute `rustlings hint variables1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE // I AM NOT DONE

View File

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

View File

@ -1,11 +1,9 @@
// variables3.rs // variables3.rs
// Make me compile! Execute the command `rustlings hint variables3` if you want a hint :) // Execute `rustlings hint variables3` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE // I AM NOT DONE
fn main() { fn main() {
let x = 3; let x: i32;
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x); println!("Number {}", x);
} }

View File

@ -1,9 +1,11 @@
// variables4.rs // variables4.rs
// Make me compile! Execute the command `rustlings hint variables4` if you want a hint :) // Execute `rustlings hint variables4` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE // I AM NOT DONE
fn main() { fn main() {
let x: i32; let x = 3;
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x); println!("Number {}", x);
} }

View File

@ -1,5 +1,5 @@
// variables5.rs // variables5.rs
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :) // Execute `rustlings hint variables5` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE // I AM NOT DONE

View File

@ -1,5 +1,5 @@
// variables6.rs // variables6.rs
// Make me compile! Execute the command `rustlings hint variables6` if you want a hint :) // Execute `rustlings hint variables6` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE // I AM NOT DONE

View File

@ -43,20 +43,20 @@ name = "variables3"
path = "exercises/variables/variables3.rs" path = "exercises/variables/variables3.rs"
mode = "compile" mode = "compile"
hint = """ hint = """
In Rust, variable bindings are immutable by default. But here we're trying Oops! In this exercise, we have a variable binding that we've created on
to reassign a different value to x! There's a keyword we can use to make line 7, and we're trying to use it on line 8, but we haven't given it a
a variable binding mutable instead.""" value. We can't print out something that isn't there; try giving x a value!
This is an error that can cause bugs that's very easy to make in any
programming language -- thankfully the Rust compiler has caught this for us!"""
[[exercises]] [[exercises]]
name = "variables4" name = "variables4"
path = "exercises/variables/variables4.rs" path = "exercises/variables/variables4.rs"
mode = "compile" mode = "compile"
hint = """ hint = """
Oops! In this exercise, we have a variable binding that we've created on In Rust, variable bindings are immutable by default. But here we're trying
line 7, and we're trying to use it on line 8, but we haven't given it a to reassign a different value to x! There's a keyword we can use to make
value. We can't print out something that isn't there; try giving x a value! a variable binding mutable instead."""
This is an error that can cause bugs that's very easy to make in any
programming language -- thankfully the Rust compiler has caught this for us!"""
[[exercises]] [[exercises]]
name = "variables5" name = "variables5"