Loops in PowerShell
Loops are used to execute code repeatedly. PowerShell supports the for, foreach, while, and do-while loops. Here's an example:
for ($i = 1; $i -le 10; $i++) {
Write-Host "Counting... $i"
}
In this example, we use a for loop to count from 1 to 10 and display each number.
No comments:
Post a Comment