Below is an example of how you can pass values through a pipeline to a function in PowerShell. All the values are kept within the enumerator object, $input, which is an implied argument that can then be used to loop through all those values one by one as follows:-
> function mul2 { >> $output = 1 >> while($input.movenext()) { >> $output *= $input.Current >> } >> $output >> }
The above command produced the following outcomes after passing a range of values through the pipeline:-
> 1..2 | mul2 2