From 1e3d9587236a1a086c36bd735ffff4054a399423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=A4=E7=8B=90=E4=B8=80=E5=86=B2?= <43949039+anonymousGiga@users.noreply.github.com> Date: Sat, 22 Jul 2023 15:43:22 +0800 Subject: [PATCH] Update chapter_3_1.md --- src/chapter_3/chapter_3_1.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/chapter_3/chapter_3_1.md b/src/chapter_3/chapter_3_1.md index 3be7dfe..5c52676 100644 --- a/src/chapter_3/chapter_3_1.md +++ b/src/chapter_3/chapter_3_1.md @@ -81,5 +81,14 @@ fn main() { let mut b: u32 = 1; // 定义可变变量b b = 2; // 对b的值进行的修改 println!("b: {:?}", b); // 输出结果为2 + + let c = 5; + { + // 在当前的花括号作用域内,对之前的c进行隐藏 + let c = 3; + println!("c: {:?}", c); // 输出结果为3 + } + println!("c: {:?}", c); // 输出结果为5 } ``` +