In programming, which type of loop will execute until a certain condition is met or not execute at all if the condition is initially false?
- While
- Do-While
- For
- If Else Statement
EXPLANATION
The do/while statement creates a loop that executes a block of code once, before checking if the condition is true, then it will repeat the loop as long as the condition is true. The do/while statement is used when you want to run a loop at least one time, no matter what.
After the body of the 'for' loop executes, the flow of control jumps back up to the increment statement. ... If it is true, the loop executes and the process repeats itself (body of loop, then increment step, and then again condition). After the condition becomes false, the 'for' loop terminates.
0 comments:
Post a Comment