Line Breaks After "." and "::"

by Oct 29, 2012

In PowerShell v3 language syntax, it is finally allowed to have line breaks after "." and "::". These symbols are used to access dynamic and static object properties. So with PowerShell v3, concatenating such statements no longer necessarily results in extra-long code lines:

PS> "Hello".toUpper().Replace('HE', 'RO')

Instead, the script author can break up the line into individual parts:

"Hello".
toUpper().
Replace('HE', 'RO')

You can even have comments in between, so it is a lot easier to document the code:

# take some text...
"Hello".
# ...convert it to uppercase...
toUpper().
# ...and replace some text:
Replace('HE', 'RO')

Twitter This Tip! ReTweet this Tip!