box-o-sand/rustbyexample/variable_bindings/declare.rs

20 lines
300 B
Rust
Raw Normal View History

2021-10-06 23:40:31 +00:00
fn main() {
let a_binding;
{
let x = 2;
a_binding = x * x;
}
println!("a binding: {}", a_binding);
let another_binding;
//println!("another binding: {}", another_binding);
another_binding = 1;
println!("another binding: {}", another_binding);
}