← concepts · the commons
control structure
6 moment(s) that assert this concept — showing 1–6 of 6
single sourceRests on a single channel — treat as a lead, verify independently
↣ how this spread over time →1A while loop is similar to an if statement, but it executes its body multiple times instead of just once.
“It's a little bit like an if statement, except that the body of the statement isn't executed just once.”
spoken · 49s · 2017-03-16
2A while loop is a control structure that executes its body repeatedly as long as a given condition remains true.
“So here's a while loop.”
spoken · 141s · 2017-03-16
3The body of a while loop is the block of code that is executed repeatedly as long as the loop condition is true.
“Everything inside the while clause, starting from the first brace and ending with the closing brace here, all of that is called the loop body.”
spoken · 263s · 2017-03-16
4The loop condition in a while loop must be checked before each iteration of the loop body.
“When it hits the while statement, it checks whether divisor is less than n, just like an if statement.”
spoken · 308s · 2017-03-16
5A while loop checks its condition before executing its body, and if the condition is false at the start, the body will not execute at all.
“And if divisor is less than n, it won't execute the loop body even once.”
spoken · 314s · 2017-03-16
6In Java, a while loop will not execute its body if the loop condition is false at the start.
“And if divisor is less than n, it won't execute the loop body even once.”
spoken · 314s · 2017-03-16