Please enable JavaScript.
Coggle requires JavaScript to display documents.
Chapter 4 : Looping Statements, :pen:SAFWAN NAJMI - Coggle Diagram
Chapter 4 : Looping Statements
4.1.1 Define Looping Statement
Looping is a sequence of instructions that
is continually repeated until a certain condition is reached.
4.1.2 List types of Looping Statement
There are 3 types of looping statements:
FOR
WHILE
DO-WHILE
4.1.3 Define FOR, WHILE and DO-WHILE loop statement
Define FOR loop statement
A for loop is a programming language statement which allows code to be repeatedly executed.
Define WHILE loop statement
A WHILE loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition.
Define DO-WHILE loop statement
A DO-WHILE loop is a control flow statement that executes a block of code at least once, and then repeatedly executes the block, or not, depending on a given Boolean condition at the end of the block.
4.1.5 Structure of FOR, WHILE and DO-WHILE loop statement
FOR statements are often used to process lists such a range of numbers.
WHILE statement is used to carry out looping operations, in which a group of statement is executed repeatedly, until some condition has been satisfied.
DO-WHILE loops are useful for things that want to loop at least once.
4.2 Understand the Looping statements
4.2.1 Differentiate the loop statements
In WHILE loop the condition is tested first
and then the statements are executed if
In DO-WHILE the statements are executed for the first time and then the conditions are tested, if the condition turns out to be true then the statements are executed again.
In FOR statement able to repeat certain parts of the program until a specified number of repetitions –
4.2.2 Explain the working of BREAK, CONTINUE and GOTO
In C programming, BREAK is used in terminating the loop immediately after it is encountered.
CONTINUE is also used with
conditional if statement.
In C programming, GOTO statement is used for altering the normal sequence of program execution by transferring control to some other part of the program.
:pen:
SAFWAN NAJMI