Skip to content

Instantly share code, notes, and snippets.

@shaneis
Created August 27, 2018 21:17
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 shaneis/ba4204b8f014d666ed2a1dd551928650 to your computer and use it in GitHub Desktop.
Save shaneis/ba4204b8f014d666ed2a1dd551928650 to your computer and use it in GitHub Desktop.
Yes or No
#region Test-ListeningConfirm
function Test-ListeningConfirm {
[CmdletBinding()]
param(
[int[]]$Numbers
)
process {
foreach ($num in $Numbers) {
$keepGoing = Read-Host "Are you sure you want to process: [$num] (Y/N)"
if ($keepGoing -eq 'Y') {
"Current number: [$num]"
} else {
break
}
}
}
}
Test-ListeningConfirm -Numbers $Numbers
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment