Imperative versus declarative programming

Imperative programming means describing the computations in terms of statements, as we do in procedural programming. In imperative programming, we instruct the computer on which operation to do and how to do it. It is an explicit sort of coding. For example, we use imperative programming to perform certain operations and catch all the exceptions that may occur, or to install software if it does not exist on a specific machine. PowerShell uses imperative programming style, except in the DSC feature. In the preceding topic, we installed the PowerShell ISE using the ServerManager module, which is an imperative programming practice. Let's revisit it—what we will do here is check whether the PowerShell ISE ...

Get Windows PowerShell for .NET Developers - 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.