I want to parse user values contained in .CSV file. I don't want my users to enter "Yes" or "No" but instead enter "True" or "False". In each case I want to convert to the equivalent boolean values: $true
or $false
. Ideally I would like a default value, so if there's misspelt "Yes or "No" I would return my default value: $true
or $false
.
Hence, I wondered if there is a neat way of doing this other than
if(){} else (){}