Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PowerShell example using switch statement to map colour name to value
$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