Iteration

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

3 parts of a loop

-Initialization -Condition -Update statement

Program constructs

-Sequence -Selection(conditional statements) -Iteration -Miscellaneous (control statements)

Types of jump statements

-break -continue -return

Block

A block is a group of one or more than one statements enclosed within curly braces.

Infinite loop

An infinite loop is a situation that arises when the control does not reach the test condition in the loop, so the loop continues working and never ends.

Exit Control loop

Another name for do-while loop. The control enters into the loop without checking any condition and after executing the given statements once the condition is checked.

for()

It allows a set of statements to be repeated or looped through a fixed number of times

Nested do-while()

Presence of one or more than one do-while statements within a do-while statement is known as nested do-while

Nested while()

Presence of one or more than one while statements within a while statement is known as nested while

Empty loop

The loop which does not contain any statement in its loop body is known as empty loop.

Semicolon after for()

The loop will execute within itself without getting into the body of the loop.

Nested for()

The presence of one or more for loops within a for loop is known as nested for loop.

While() loop

This loop is used to execute one or more than one statements till the condition is true and terminates when the conditions becomes false.

do while() loop

This loop is used to execute one or more that one statements till the condition is true and the loop terminates when the condition becomes false.

continue

This statement forces the control to perform the next iteration of the current loop.

break

This statement is used to terminate the execution of current loop and comes out of the loop.

Jump statements

Those statements that unconditionally transfer program control within a function are known as jump statements.

Entry control loop

While loop is also called entry control loop as it checks the condition before entering the block and executing the statements.

Syntax for nested for()

for(initial value; condition; update) { for(initial value; condition; update) { statements; } }

Syntax for for()

for(initial value; test condition; update) { statements; }

Syntax of while()

initial values while(conditions) { statements; update statements; }


संबंधित स्टडी सेट्स

Chapter 5: Supporting the Power System and Troubleshooting Computers

View Set

Burden of Proof, Presumption, and Judicial Notice

View Set

Chapter 1-3 Cengage Learning Notes [Progress 15%]

View Set