That's not really Shiyao's question. The question really ends up being,
'What is the scope of a fish file outside of a function body?' Most
programming languages have an implicit scope for the program itself.

On Wed, Nov 15, 2017 at 10:56 AM Glenn Jackman <jack...@pythian.com> wrote:

> 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 <(613)%20565-8696>
> Mobile: +1 613 808 4984 <(613)%20808-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
>
------------------------------------------------------------------------------
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

Reply via email to