-
Variables. By default, variables are immutable.
let x = 5;
-
Variables mutable.
let mut y = 5;
y = 6;
-
Shadowing
let x = 6;
-
Constants ( required data type, can't be changed, can't be shadowed) whatever scope
const AGE: i32 = 23;
-
Signed
i8, i16, i32, i64, i128, isize
-
Unsigned
u8, u16, u32, u64, u128, usize
f32, f64
bool
char
- Single quotes
''
let tuple = ('a', 32, true);
let (x, y, z) = tuple;
assign each value of tuplelet value1 = tuple.0
get first value of tuple
[i125:5]
<type, size>let array = [1, 2, 5]
fixed size
let name = "kevin"
let address: &'static str = "C 123"
let lastName: String = "cuadros"