DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

Loops — Example 71

Quick explanation + ready code for: Loops.

PowerShell Loops Back to examples
Back to language
Syntax: Loops in PowerShell. ID: #71

Code

$sum=0
1..9 | ForEach-Object { $sum += $_ }
Write-Host $sum

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.