Docsity

Understanding Condition-Controlled Loops in Programming, Schemes and Mind Maps of Computer science

Partial preview of the text

Download Understanding Condition-Controlled Loops in Programming and more Schemes and Mind Maps Computer science in PDF only on Docsity!

CONDITION-

CONTROLLED

LOOPS

What is a condition-

controlled loop?

A conditional controlled

loop may execute an

indeterminate number

of times.

They provide a flexible way to
control the flow of your
program based on the values
of variables or other
conditions.

A conditional loop could be

used to request input from

the user and keep re-

prompting until the input is

correct

A conditional controlled loop repeats a series of one or more Fortran statements based on a condition.

Types of

CONDITION-

CONTROLLED

LOOPS

WHILE LOOP DO-WHILE LOOP^ FOR LOOP A condition-controlled loop that allows the loop to continue executing as long as a specific condition is true. The condition is evaluated before the loop body is executed, and the loop exits when the condition is false. Similar to a while loop, but the loop body is executed at least once before the condition is evaluated. This means that the loop will always execute at least once, even if the condition is false. A condition-controlled loop that allows the loop to continue executing for a specific number of iterations. The loop body is executed once for each iteration, and the loop exits when the number of iterations TYPES OF CONDITION CONTROLLED LOOPS