February 2019
Intermediate to advanced
626 pages
15h 51m
English
As the condition for a while loop comes first, the body of the loop will only execute if the condition evaluates to true:
while (<condition>) {
<body-statements>
}
A while loop may be used to wait for something to happen. For example, it might be used to wait for a path to exist:
while (-not (Test-Path $env:TEMP\test.txt -PathType Leaf)) {
Start-Sleep -Seconds 10
}
Read now
Unlock full access