title: PowerShell Write-Output inside "if" does not output anything
body: <p>I am learning PowerShell recently, and found a behavior that I cannot understand. Let me explain in code below:</p>
  
  <pre><code>function func1()
  {
      Write-Output "output from func1()"
      func2
      return $true
  }
  
  function func2()
  {
      Write-Output "output from func2()"
      func3
  }
  
  function func3()
  {
      Write-Output "output from func3()"
  }
  
  Write-Output "*** 1. run alone ****"
  func1
  
  Write-Output "*** 2. run inside if ****"
  if (func1) {
      #do nothing
  }
  </code></pre>
  
  <p>It is strange when func1 is called directly, it can output message as expected, but if put inside "if" statement, it will not. See output as below:</p>
  
  <pre><code>*** 1. run alone ****
  output from func1()
  output from func2()
  output from func3()
  True
  *** 2. run inside if ****
  </code></pre>
  
  <p>You can see it's empty. Why is that, and how can I enable the output like the first example? Thanks!</p>