The local scope is the function body, while it's running. Your example does
not really demonstrate it. This does:
$ set KK 3
$ function foo; set -l KK 33; echo $KK; end
$ echo $KK
3
$ foo
33
$ echo $KK
3
Another way to introduce a scope is with `begin`:
$ echo $KK; begin; set -l KK 44; echo $KK; end; echo $KK
3
44
3
On Wed, Nov 15, 2017 at 9:58 AM, Shiyao MA <i...@introo.me> wrote:
> Hi,
>
> For the following script,
>
> // test.fish
> set -l KK 3
>
> function main
> echo $KK
> end
>
> main
>
> // file ends...
>
> echo $KK will give nothing.
>
> My question is, for "set -l KK 3". What does the -l (local) mean here?
>
> --
> Best,
> Shiyao
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
--
*Glenn Jackman*
Senior Software Developer
*Pythian - Love your data*
jack...@pythian.com
Tel: +1 613 565 8696 Ext. 1478
Mobile: +1 613 808 4984
www.pythian.com
--
--
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users