Skip to content

Instantly share code, notes, and snippets.

@chriskuech
Created June 7, 2019 06:20
Show Gist options
  • Save chriskuech/c228edae8108555f41edca79f8ee5c66 to your computer and use it in GitHub Desktop.
Save chriskuech/c228edae8108555f41edca79f8ee5c66 to your computer and use it in GitHub Desktop.
# this outer scope contains only immutable variables
$var = & {
# this scope contains mutable temporary variables
$queue = [System.Collections.Generic]::new()
$queue.Enqueue(@{Id = 1})
while ($queue.Count) {
$jobInfo = $queue.Dequeue()
$newJobInfo = Update-RemoteJob $jobInfo # non-deterministic
if ($newJobInfo) {
$queue.Enqueue($newJobInfo)
}
}
Get-RemoteResult # output a value to assign to `$var`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment