Add some exercises about variables!

This commit is contained in:
Carol (Nichols || Goulding)
2015-09-16 20:19:24 -04:00
parent 32900581b9
commit f4c6dcf1d7
5 changed files with 41 additions and 0 deletions

6
variables/variables1.rs Normal file
View File

@@ -0,0 +1,6 @@
// Make me compile!
fn main() {
x = 5;
println!("x has the value {}", x);
}

10
variables/variables2.rs Normal file
View File

@@ -0,0 +1,10 @@
// Make me compile!
fn main() {
let x;
if x == 10 {
println!("Ten!");
} else {
println!("Not ten!");
}
}

8
variables/variables3.rs Normal file
View File

@@ -0,0 +1,8 @@
// Make me compile!
fn main() {
let x = 3;
println!("Number {}", x);
x = 5;
println!("Number {}", x);
}

6
variables/variables4.rs Normal file
View File

@@ -0,0 +1,6 @@
// Make me compile!
fn main() {
let x: i32;
println!("Number {}", x);
}