Chapter 6. Flow control in scripts

6.1 The conditional statement
6.2 Looping statements
6.3 Labels, break, and continue
6.4 The switch statement
6.5 Flow control using cmdlets
6.6 Statements as values
6.7 A word about performance
6.8 Summary

I may not have gone where I intended to go, but I think I have ended up where I needed to be.

Douglas Adams, The Long Dark Tea-Time of the Soul

Previous chapters showed how you can solve surprisingly complex problems in PowerShell using only commands and operators. You can select, sort, edit, you and present all manner of data by composing these elements into pipelines and expressions. In fact, commands and operators were the only elements available in the earliest prototypes of PowerShell. Sooner ...

Get Windows PowerShell in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.