Two very similar things give different results

Reading up on how the -contains operator works seem to suggest it should provide a match if I enter one of the matching values

[string]$passwords = 4973,3234,9874,4138,4480,3129,5397,8363,5022,2352,4848,4541 [string]$PasswordNumber = Read-Host -Prompt 'password' while ($passwords -Contains $PasswordNumber) { Write-Host 'match' [string]$PasswordNumber = Read-Host -Prompt 'password' } 

It does not seem to work.

However, this works fine

[string]$passwords = 4973,3234,9874,4138,4480,3129,5397,8363,5022,2352,4848,4541 [string]$PasswordNumber = Read-Host -Prompt 'password' while ($passwords.Contains($PasswordNumber)) { Write-Host 'match' [string]$PasswordNumber = Read-Host -Prompt 'password' } 

submitted by /u/FireLucid
[link] [comments]

Leave a Reply