blob: 7db42a956606e15e3525725b7463b3f94ee0a4a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
fn main() {
// Reading uninitialized variables isn't allowed in Rust!
// Therefore, we need to assign a value first.
let x: i32 = 42;
println!("Number {x}");
// It possible to declare a variable and initialize it later.
// But it can't be used before initialization.
let y: i32;
y = 42;
println!("Number {y}");
}
|