Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PowerShell example using switch statement to map colour value to name
$colourValue = 0x00FF00
$colourName = switch ($colourValue) {
0xFF0000 { 'red'; break }
0x00FF00 { 'green' ; break }
0x0000FF { 'blue'; break }
0xFFFFFF { 'white'; break }
default { 'none' }
return $colourName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment