Add some exercises about variables!
This commit is contained in:
6
variables/variables1.rs
Normal file
6
variables/variables1.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
// Make me compile!
|
||||
|
||||
fn main() {
|
||||
x = 5;
|
||||
println!("x has the value {}", x);
|
||||
}
|
||||
10
variables/variables2.rs
Normal file
10
variables/variables2.rs
Normal 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
8
variables/variables3.rs
Normal 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
6
variables/variables4.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
// Make me compile!
|
||||
|
||||
fn main() {
|
||||
let x: i32;
|
||||
println!("Number {}", x);
|
||||
}
|
||||
Reference in New Issue
Block a user