title: Why isn't my Switch statement prompting for user input exiting properly?
body: <p>I have written a Switch statement where, if the user inputs anything other than Y or N, the script should keep prompting until they enter either one of those letters.</p>
  <pre><code>$Prompt = Read-host &quot;Should I display the file contents c:\test for you? (Y | N)&quot; 
  Switch ($Prompt)
       {
         Y {Get-ChildItem c:\test}
         N {Write-Host &quot;User canceled the request&quot;}
         Default {$Prompt = read-host &quot;Would you like to remove C:\SIN_Store?&quot;}
       }
  </code></pre>
  <p>What happens now, however, is that when the user inputs anything other than Y or N, they get prompted again. But when they type <em>any</em> letter the second time, the script just exits. It doesn't ask the user for their input anymore. Is it possible to accomplish this using Switch?</p>