Which type of loop is best known for its boolean condition that controls entry to the loop?
A: do-while loopB: for(traditional)
C: for-each
D: while
Answer:
D: while
Explanation:
The type of loop best known for its boolean condition that controls entry to the loop is the "while" loop.
Here is the general syntax for a "while" loop:
while (boolean condition) {
// loop body
}
In the "while" loop, the boolean condition is evaluated before each iteration. If the condition evaluates to true, the loop body is executed. If the condition evaluates to false, the loop is terminated and control moves to the next statement after the loop.
Comments
Post a Comment