Learn
At times, we will want to achieve different outcomes based on the state of our data within a script. This behavior is known as control flow and uses conditional statements and loops that allow us to execute our code in a desired fashion.
In this lesson, we’ll look at
if
,else
, andelseif
statementsswitch
statementsfor
andforeach
loopswhile
anddo
…while
anddo
…until
loopsbreak
andcontinue
commands
Using the correct form of control flow will help create scripts with different behaviors that are easy to understand and improve upon.
Instructions
Click Next to start learning about control flow in PowerShell.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.