Summary
We started the chapter by looking at IDEs and installing the recommended environment for PowerShell 7, VS Code. VS Code is a large and ever-changing application. We need to spend time familiarizing ourselves with it and keep regularly updated as the features and capabilities change frequently. We have seen that it is easy to use and very powerful.
We then looked at the two main ways of controlling flow within a program: conditionals and loops. We spent a lot of time on the if
, else
, and elseif
conditional statements and then looked at the related switch
statement.
After that, we looked at loops. We started with a loop that will iterate through all the elements in an array – the foreach
loop – and explored how it differs from the ForEach-Object
cmdlet. We looked at do while
and do until
, which will repeat a loop while a condition is true or false, and then we looked at the while
loop, which swaps the position of the condition and the scriptblock. The last...