|
CTP2 comparison operators In the following code, a comparison against a random number by an integer
yields an incorrect result. If the random number is 500, entering a 4 yields
a correct result, but entering a 6 yields IF(6 -gt 500) as TRUE.
$Random=Get-Random -min 1 -max 1000
$Guess=0
While ($Guess -ne $Random)
{
$Guess=Read-Host "Please enter your guess (Enter ZERO to quit)"
$Guess
$Random
if ($Guess -eq 0) {Write-host "Buh-Bye";Break}
If ($Guess -lt $Random) {Write-Host -foregroundcolor RED "Too LOW!!!"}
If ($Guess -gt $Random) {Write-Host -foregroundcolor RED "Too HIGH!!!"}
If ($Guess -eq $Random) {Write-host -foregroundcolor RED "You Got
it!!!";Break}
}
Did I do something wrong or is there a bug somewhere? |