-Contains operator not working powershell -


all i'm trying see if user input $month in array $months. it's not liking something. help?

write-host "the script collect user high tempature , low tempature day in degrees f." $months = @("january", "february","march","april","may","june","july","august","september","october","november","december") $finished = $false while ($finished -eq $false){     $month = read-host "enter month";     if ($months -contains $month)     {         write-host "invalid entry"         $finished = $false     }     else     {         $finished = $true     } } 

you test logic not one, reverse youy test or reverse actions:

write-host "the script collect user high tempature , low tempature day in degrees f." $months = @("january", "february","march","april","may","june","july","august","september","october","november","december") $finished = $false while ($finished -eq $false){     $month = read-host "enter month";     if ($months -contains $month)     {         $finished = $true     }     else     {         write-host "invalid entry"         $finished = $false     } } 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -