Should have replied to list. ----- Original message ----- From: Greg Reagle <greg.rea...@umbc.edu> To: Mark Volkmann <r.mark.volkm...@gmail.com> Subject: Re: [Fish-users] default function parameters Date: Fri, 18 Aug 2017 18:43:28 -0400
On Fri, Aug 18, 2017, at 18:25, Mark Volkmann 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'. function greet -a name language switch "$language" case spanish echo "Hola, $name" case english '*' echo "Hello, $name" end end ------------------------------------------------------------------------------ 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