Update Examples

Glen Whitney 2024-08-25 00:59:31 +00:00
parent abb1dd87d5
commit a23e1fa400

@ -539,10 +539,38 @@ Or here.
<td>
```
fn main() {
let long_lived_binding = 1;
{
let short_lived_binding = 2;
println!("inner short: {}", short_lived_binding);
}
// Error! `short_lived_binding` doesn't exist in this scope
println!("outer short: {}", short_lived_binding);
// FIXME ^ Comment out this line
println!("outer long: {}", long_lived_binding);
}
```
</td><td>
```
fn main
let long_lived_binding = 1
scope //! Husht needs a keyword; other choices exist
let short_lived_binding = 2
println! "inner short: {}", short_lived_binding
// Error! `short_lived_binding` doesn't exist in this scope
println! "outer short: {}", short_lived_binding
// FIXME ^ Comment out this line
println! "outer long: {}", long_lived_binding
```
</td></tr></table>