in PowerShell advanced functions, the begin, process, end sections are available for use. The begin and end blocks only execute once, while the process block executes once per item passed in on the pipeline. Functions that collect several items and return them (particularly "Get" commands) should return objects as they are created rather than waiting until the end block.
Change any of these:
begin {
$things = @()
}
process {
$things += makeNewThing()
}
end {
$things
}
in PowerShell advanced functions, the begin, process, end sections are available for use. The begin and end blocks only execute once, while the process block executes once per item passed in on the pipeline. Functions that collect several items and return them (particularly "Get" commands) should return objects as they are created rather than waiting until the end block.
Change any of these:
to