Last active
August 18, 2019 07:56
-
-
Save PlagueHO/e6c2ab0bb956b300d1969c3be06b5f3f to your computer and use it in GitHub Desktop.
PowerShell example using switch statement to map colour name to value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$colourName = 'green' | |
$colourValue = switch ($colourName) { | |
'red' { 0xFF0000; break } | |
'green' { 0x00FF00; break } | |
'blue' { 0x0000FF; break } | |
'white' { 0xFFFFFF; break } | |
default { 0x0 } | |
} | |
return $colourValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment