Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.