CHAPTER 7Flow Control and Object Disposal
Like other powerful programming and scripting languages, Windows PowerShell supports looping and branching logic. The looping statements in Windows PowerShell let you perform sequences of commands on all members of a collection (such as sites in a site collection) or on only those that meet a particular condition. Windows PowerShell also includes two cmdlets that can be used for flow control. This chapter covers how to use these flow-control facilities, as well as how to dispose of objects.
Windows PowerShell supports the conditional statement if/elseif/else, which branches execution based on a condition, and the switch statement, which can handle multiple complex conditions. ...