PS: Coding Style
Description:
When it comes to Powershell, there are two main styles that people will follow (actually three, but the third is just like one of them):
To Resolve:
-
Styles:
- OTBS
1 2 3 4 5 6 7 8 9
function Get-Noun { end { if($Wide) { Get-Command | Sort-Object Noun -Unique | Format-Wide Noun } else { Get-Command | Sort-Object Noun -Unique | Select-Object -Expand Noun } } }
-
Stroustup: Same as OTBS but will place “else” in a new line.
-
Allman
1 2 3 4 5 6 7 8 9 10 11 12 13 14
function Get-Noun { end { if($Wide) { Get-Command | Sort-Object Noun -Unique | Format-Wide Noun } else { Get-Command | Sort-Object Noun -Unique | Select-Object -Expand Noun } } }
Comments