July 2018
Beginner
552 pages
13h 18m
English
The while loop, in comparison to the do loop, has its conditional expression at the beginning, and therefore, the statement will only be executed as long as the conditional expression returns $true:
# simple syntax of a while-loop# while (<condition>)# {# <statement list># }
Take a look at the following example, which returns the same values as the do loop examples:
# simple example for while-loop$a = 0while ($a -lt 5) { $a++ $a }# 1, 2, 3, 4, 5
Read now
Unlock full access