title: Why is the value of "switch" type parameter passed to a string parameter?
body: <p>The test code (<code>test.ps1</code>):</p>
  
  <pre><code>Param(
      [string]$content = $null,
      [switch]$flag = $false
  )
  Write-Host $content
  </code></pre>
  
  <p>Output:</p>
  
  <pre>
  PS C:\Users\powershell> .\test.ps1
  
  PS C:\Users\powershell> .\test.ps1 -flag $true    
  True
  PS C:\Users\powershell> .\test.ps1 -flag $false
  False
  PS C:\Users\powershell> .\test.ps1 -flag $true -content "lalala"
  lalala
  </pre>
  
  <p>No matter I set <code>$content</code> to <code>$null</code>, or <code>""</code>, or without any default value, the output is the same. </p>
  
  <p>So why does <code>$content</code> take the value from <code>$flag</code>?</p>