We have seen how operators work. Try out more of these operators until it becomes second nature to you. Most of the flow control, as well as filtration in scripts, happens using these operators.
In this recipe, we are going to look at conditional script flow, also known as branching. In essence, branching works on two conditions (correct: $true and $false). This is generally achieved using two constructs:
- The If–ElseIf–Else construct
- The Switch–Case construct
In this recipe, we will give ourselves a simple problem to solve: finding out if today is one of the days of the weekend.