mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
clarify docs on variable scope in functions
This commit is contained in:
parent
4cb70e8e2a
commit
737972be2f
2 changed files with 2 additions and 2 deletions
|
@ -828,7 +828,7 @@ creating or updating a variable are:
|
||||||
|
|
||||||
-# If a variable is explicitly set to either universal, global or local, that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed.
|
-# If a variable is explicitly set to either universal, global or local, that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed.
|
||||||
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the variable scope is not changed.
|
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the variable scope is not changed.
|
||||||
-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing functions. If no function is executing, the variable will be global.
|
-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing function. Note that this is different from using the \c -l or \c --local flag. If one of those flags is used, the variable will be local to the most inner currently executing block, while without these the variable will be local to the function. If no function is executing, the variable will be global.
|
||||||
|
|
||||||
There may be many variables with the same name, but different scopes.
|
There may be many variables with the same name, but different scopes.
|
||||||
When using a variable, the variable scope will be searched from the
|
When using a variable, the variable scope will be searched from the
|
||||||
|
|
|
@ -44,7 +44,7 @@ The scoping rules when creating or updating a variable are:
|
||||||
|
|
||||||
-# If a variable is explicitly set to either universal, global or local, that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed.
|
-# If a variable is explicitly set to either universal, global or local, that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed.
|
||||||
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the previous variable scope is used.
|
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the previous variable scope is used.
|
||||||
-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing functions. If no function is executing, the variable will be global.
|
-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing function. Note that this is different from using the \c -l or \c --local flag. If one of those flags is used, the variable will be local to the most inner currently executing block, while without these the variable will be local to the function. If no function is executing, the variable will be global.
|
||||||
|
|
||||||
The exporting rules when creating or updating a variable are identical
|
The exporting rules when creating or updating a variable are identical
|
||||||
to the scoping rules for variables:
|
to the scoping rules for variables:
|
||||||
|
|
Loading…
Reference in a new issue