5.3. Functions and Script Blocks
Combining functions and script blocks results in some very powerful programming techniques. By combining functions' ability to create new commands with the dynamic nature of script blocks, we can get very close to the built-in PowerShell language syntax. Calling a function that accepts a single script block closely resembles using the if, while, or switch statements. That makes our code look as if it builds and uses new language constructs that makes it easier to read and understand. In addition to the cool syntax, script blocks make a perfect tool for encapsulating actions or strategies that can be executed by a function as it traverses various objects.
5.3.1. Implementing New Control Structures
I do not remember ...
Get Pro Windows PowerShell 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.