diff options
Diffstat (limited to 'A scope block is an expression.md')
-rw-r--r-- | A scope block is an expression.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/A scope block is an expression.md b/A scope block is an expression.md new file mode 100644 index 0000000..29f6214 --- /dev/null +++ b/A scope block is an expression.md @@ -0,0 +1,13 @@ +[[Rust]] + +An expression evaluates to a value. In Rust that can also mean a scope block as follows: +```rust +fn main() { + let y = { + let x = 3; + x + 1 + }; + + println!("The value of y is: {y}"); +} +```
\ No newline at end of file |