I was so close!
I had this:
set -q language; or set language 'english'
Why do I need the [1] part?
On Fri, Aug 18, 2017 at 5:51 PM, Kurtis Rader <kra...@skepticism.us> wrote:
> Add this to the top of the function:
>
> set -q language[1]
> or set language english
>
> On Fri, Aug 18, 2017 at 3:25 PM, Mark Volkmann <r.mark.volkm...@gmail.com>
> wrote:
>
>> What's the best way to provide a default value for a function parameter?
>> For example, suppose I have a function like this:
>>
>> function greet -a name language
>> switch "$language"
>> case 'english'
>> echo 'Hello, '$name
>> case 'spanish'
>> echo 'Hola, '$name
>> case '*'
>> echo unsupported language $language
>> end
>> end
>>
>> If it is called with "greet Bob", I want language to default to 'english'.
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>>
>> ------------------------------------------------------------
>> ------------------
>> 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
>>
>>
>
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>
--
R. Mark Volkmann
Object Computing, Inc.
------------------------------------------------------------------------------
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