title: How do I set a default value for a named function argument?
body: <p>I have dug for an answer to this and <a href="https://unix.stackexchange.com/questions/81421/how-do-i-reference-a-variable-in-fish-shell-with-a-default-fallback">what I've found</a> doesn't seem to work. If I run <code>weather "NYC"</code>, the echo'd line is "weather = NYC", however if I run <code>weather</code>, the echo'd line is "weather = ". How do I set a default value for <code>$location</code>?</p>
  
  <pre><code>function weather --argument location --description "Display weather information for a given location"
    set -q location; or set location "San Francisco, CA"
    echo "weather = $location"
    curl -H "Accept-Language: en" "wttr.in/$location?u"
  end
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I have been able to get the desired behavior with the following change but am still curious if the <code>set -q location; or set location "San Francisco, CA"</code> should work. It seems to on the command line, but not in the function.</p>
  
  <pre><code>if not test -n "$location"
    set location "Washington, DC"
  end
  </code></pre>