variables1.rs#
fn main() {
let x = 5;
println!("x has the value {}", x);
}
variables2.rs#
fn main() {
let x: u16 = 32;
if x == 10 {
println!("x is ten!");
} else {
println!("x is not ten!");
}
}
variables3.rs#
fn main() {
let x: i32 = 6;
println!("Number {}", x);
}
variables4.rs#
fn main() {
let mut x = 3;
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x);
}
variables5.rs#
fn main() {
let number = "T-H-R-E-E"; // don't change this line
println!("Spell a Number : {}", number);
{
let number = 3; // don't rename this variable
println!("Number plus two is : {}", number + 2);
}
}
variables6.rs#
const NUMBER: u8 = 3;
fn main() {
println!("Number {}", NUMBER);
}