title: Is there a way in Powershell for a boolean parameter to automatically be true if not specified when the function is called?
body: <p>If the function is called <code>myFunc -IsLightOn $true</code>, it should return nothing. <code>myFunc - IsLightOn $False</code> should return "Light off". However, not specifying true or false for <code>IsLightOn</code> parameter should default the variable to true and thus return nothing</p>
  
  <pre><code>function myFunc{
     Param(
      [bool]$IsLightOn
     ) if ($LightIsOn -EQ $false){
        Write-Host "Light off"
     }
  }
  </code></pre>
  
  <p>Everything works when the value is specified but I don't know how to default <code>IsLightOn</code> to true.</p>