title: Powershell, check for blank input, zero evaluates as blank/null
body: <p>I am trying to validate a simple powershell input. I want to allow the number zero as valid input, but blank (just pressing enter) is not valid input. I am having the most difficult time with the validation. Everything works EXCEPT when the user enters the number zero.
  I have tried checking the length, checking for null, etc. 
  Consider the code below. 
  If you enter 0 (zero) the output is the same as if you just press [enter] (no input)</p>
  
  <pre><code>Pick a number 0-6: 0
  You picked 0
  blank input
  equals zero
  too short
  
  
  $OUchoice = -1
  do
  {
      try{
          $OUchoice = Read-Host "Pick a number 0-6" 
      }
      catch{
          write-host "invalid input"
      }
  
      Write-Host "You picked $OUchoice"
  
      if ($OUchoice -gt 6) {write-host "too high"}
      if ($OUchoice -lt 0) {write-host "too low"}
      if ($OUchoice -eq "") {write-host "blank input"}
      if ($OUchoice -eq 0 ) {write-host "equals zero"}
      if ($OUchoice -eq $null ) {write-host "Null"}
      if (!($OUchoice)) {write-host "too short"}  
  }
  until (($OUchoice -ge 0) `
          -and ($OUchoice -le 6) `
          -and (($ouchoice)))
  
  write-host "OK"
  </code></pre>
  
  <p>I have tried -eq $NULL and -eq "". What is the proper way to allow zero and disallow blank input?</p>