From 5e22a8bc763a3290c4b0bed72439c8eda045b575 Mon Sep 17 00:00:00 2001 From: Glenn Jackman Date: Tue, 7 Jan 2025 22:53:33 -0500 Subject: [PATCH] Use wording from the manual --- concepts/functions/about.md | 4 +++- concepts/functions/introduction.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/concepts/functions/about.md b/concepts/functions/about.md index a07d9598..ddf04592 100644 --- a/concepts/functions/about.md +++ b/concepts/functions/about.md @@ -40,7 +40,9 @@ If you declare the variables with the `local` command, the _scope_ of the variab Otherwise, the variable is placed in the _global scope_. Local variables can have the same name as a global variable. -In that case, the local variable _temporarily_ overrides the global one, and the global value is restored when the function returns. +In that case, the local variable "shadows" the global variable. +For instance, a local variable declared in a function hides a global variable of the same name: references and assignments refer to the local variable, leaving the global variable unmodified. +When the function returns, the global variable is once again visible. ```bash x=5 diff --git a/concepts/functions/introduction.md b/concepts/functions/introduction.md index ecdb755f..ddf04592 100644 --- a/concepts/functions/introduction.md +++ b/concepts/functions/introduction.md @@ -40,7 +40,9 @@ If you declare the variables with the `local` command, the _scope_ of the variab Otherwise, the variable is placed in the _global scope_. Local variables can have the same name as a global variable. -In that case, the local variable takes precedence over the global variable. +In that case, the local variable "shadows" the global variable. +For instance, a local variable declared in a function hides a global variable of the same name: references and assignments refer to the local variable, leaving the global variable unmodified. +When the function returns, the global variable is once again visible. ```bash x=5