Manage Large Conditional Statements with Switches

1. Problem
You want to find an easier or more compact way to represent a large if … elseif … else conditional statement.
2. Solution
Use PowerShell’s switch statement to more easily represent a large if … elseif … else conditional statement.
For example:
        $temperature = 20
 
        switch($temperature)
        {
           { $_ -lt 32 }   { “Below Freezing”; break [...]