title: If statement in an if statement
body: <p>For an assignment I have to prove that if statements can be placed within if statements in a Powershell script. Therefore I made the enclosed script. I am however not sure whether the script I have describes two separate if statements or would be considered an if within an if. </p>
  
  <pre><code>[int]$a = Read-host "Please input a number." 
  if ($a –eq 5) { 
  Write-Host “a is 5” } 
  if ($a –ne 5) { 
  Write-Host “a isn't 5” }
  Read-host
  </code></pre>
  
  <p>Any help on this one?</p>
  
  <hr>
  
  <p>Thank you for your answer. Why does this not work however?</p>
  
  <pre><code>if ($a –lt 2) { 
      if ($a –lt 3) {       
          if ($a –lt 4) { 
               if ($a –lt 5) {  
               Write-Host “a is less than 5” }
          Write-Host “a is less than 4” } 
      Write-Host “a is less than 3” }
  Write-Host “a is less than 2” }
  </code></pre>