mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-29 00:34:17 -05:00
13 lines
351 B
Rust
13 lines
351 B
Rust
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}");
|
|
}
|