Test Scripts
suggest changeThe ISE, included with Windows PowerShell 3.0 through 5.1, can run the selected text in the editor with F8.
$input is the automatic pipeline enumerator. Do not name a parameter $input. The call sits outside the function. The sum of 1 through 10 is 55.
function Get-Sum {
foreach ($i in $input) {
$Sum += $i
}
$Sum
}
1..10 | Get-Sum
55
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents