My code tells you whether your guessed number is higher or lower than a randomly generated number, but it seems to only compare the first digits of the number when one of th
This is because you're comparing a string to an integer. The order matters.
"56" -lt 7
Is actually the same as:
"56" -lt "7"
Alternatively:
56 -lt "7"
would give you the correct result. PowerShell tries to coerce the right side argument to the type of the left side.
You might try an explicit cast:
[int]$Input -lt $GeneratedNum