Skip to content

Instantly share code, notes, and snippets.

@brettmillerb
Created January 29, 2018 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettmillerb/066e9f1644946f0da96f69b2eb05b3a6 to your computer and use it in GitHub Desktop.
Save brettmillerb/066e9f1644946f0da96f69b2eb05b3a6 to your computer and use it in GitHub Desktop.
Set-IncrementDirection
function Set-IncrementDirection {
Param (
[Parameter(Mandatory = $true,
Position = 0,
ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[int]$value,
[switch]$decrease
)
if ($PSBoundParameters.ContainsKey('decrease')) {
$value--
}
else {
$value++
}
$value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment