O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Formatting your code

Screen space should be conserved as much as possible while still allowing code formatting to reflect logical structure and nesting. Here are a few suggestions:

  • Indent standard nested blocks by at least two spaces.

  • Block overview comments for a function by using the Windows PowerShell multiline comment feature.

  • Block the highest-level statements, with each nested block indented an additional two spaces.

  • You should align the begin and end script block brackets. This will make it easier to follow the code flow.

  • Avoid single-line statements. In addition to making it easier to follow the flow of the code, this also makes it easier when you end up searching for a missing curly bracket.

  • Break each pipelined object at the pipe. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required