while

Loops through the statements enclosed within theĀ { code block } until the test_expression is false:

 

while (test_expression) {
statements ;
}

 

Save & refresh browser:

val = 0
val = 1
val = 2
val = 3
val = 4

Leave a Reply