Scope
Where a variable is visible.
Block scope
Each { } block creates a new scope. Bindings declared inside a block are not visible outside it.
fn main() {
let x = 1
if true {
let y = 2
print(x)
print(y)
}
}fn main() -> void {
let x: i32 = 1
if true {
let y: i32 = 2
print(x)
print(y)
}
}Output
1
2