title: Empty parameter is not Null in function
body: <p>Given this basic function:</p>
  
  <pre><code>Function TestFunction {
      Param ( [int]$Par1, [string]$Par2, [string]$Par3 )
      If ($Par1 -ne $Null) { Write-Output "Par1 = $Par1" }
      If ($Par2 -ne $Null -or $Par2 -ne '') { Write-Output "Par2 = $Par2" }
      If ($Par3 -ne $Null) { Write-Output "Par3 = $Par3" }
  }
  TestFunction -Par1 1 -Par3 'par3'
  </code></pre>
  
  <p>...the output is:</p>
  
  <pre><code>Par1 = 1
  Par2 = 
  Par3 = par3
  </code></pre>
  
  <p>Even though I didn't pass anything into the <code>$Par2</code> variable, it still isn't Null or empty. What happened, and how can I rewrite the statement so that the second If-statement evaluates as False and the script-block does not get executed?</p>
  
  <p>(I added the <code>-or $Par2 -ne ''</code> just to test, it behaves the same with and without it.)</p>