Update Exercises Directory Names to Reflect Order
This commit is contained in:
9
exercises/01_variables/README.md
Normal file
9
exercises/01_variables/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Variables
|
||||
|
||||
In Rust, variables are immutable by default.
|
||||
When a variable is immutable, once a value is bound to a name, you can’t change that value.
|
||||
You can make them mutable by adding `mut` in front of the variable name.
|
||||
|
||||
## Further information
|
||||
|
||||
- [Variables and Mutability](https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html)
|
||||
13
exercises/01_variables/variables1.rs
Normal file
13
exercises/01_variables/variables1.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
// variables1.rs
|
||||
//
|
||||
// Make me compile!
|
||||
//
|
||||
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
x = 5;
|
||||
println!("x has the value {}", x);
|
||||
}
|
||||
15
exercises/01_variables/variables2.rs
Normal file
15
exercises/01_variables/variables2.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
// variables2.rs
|
||||
//
|
||||
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let x;
|
||||
if x == 10 {
|
||||
println!("x is ten!");
|
||||
} else {
|
||||
println!("x is not ten!");
|
||||
}
|
||||
}
|
||||
11
exercises/01_variables/variables3.rs
Normal file
11
exercises/01_variables/variables3.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
// variables3.rs
|
||||
//
|
||||
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let x: i32;
|
||||
println!("Number {}", x);
|
||||
}
|
||||
13
exercises/01_variables/variables4.rs
Normal file
13
exercises/01_variables/variables4.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
// variables4.rs
|
||||
//
|
||||
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let x = 3;
|
||||
println!("Number {}", x);
|
||||
x = 5; // don't change this line
|
||||
println!("Number {}", x);
|
||||
}
|
||||
13
exercises/01_variables/variables5.rs
Normal file
13
exercises/01_variables/variables5.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
// variables5.rs
|
||||
//
|
||||
// Execute `rustlings hint variables5` or use the `hint` watch subcommand for 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; // don't rename this variable
|
||||
println!("Number plus two is : {}", number + 2);
|
||||
}
|
||||
11
exercises/01_variables/variables6.rs
Normal file
11
exercises/01_variables/variables6.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
// variables6.rs
|
||||
//
|
||||
// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
const NUMBER = 3;
|
||||
fn main() {
|
||||
println!("Number {}", NUMBER);
|
||||
}
|
||||
Reference in New Issue
Block a user