$UserChoice = Read-Host "Enter # of tool you want to run"
switch -exact ($UserChoice) {
1 {Write-Host 'You selected 1'}
1a {Write-Host 'You selected 1a'}
1b {Write-Host 'You selected 1b'}
1c {Write-Host 'You selected 1c'}
1d {Write-Host 'You selected 1d'}
}
Preface: I know the fix is to put the comparison values in quotes, ex: '1d'
. I want to know WHY PowerShell is acting the way it is for learning sake.
- If I enter 1b at prompt, it returns 1b whereas if I enter 1d it returns nothing, why?
- If I enter 1b at prompt, it returns 1b whereas if I enter 1 it returns 1 and 1d, why?
- It seems PowerShell is interpreting d in a switch statement comparison value different for some reason, why?
--EDIT: I just noticed VISUALLY the comparison values are different colors (1 & 1d are darker) so I guess PowerShell ISE syntax highlighting is telling us they're being treated differently. 4. What do the colors mean (maroon/dark-RedOrPurple VS purple?