Saturday, March 10, 2012

Two Categories of Loops

There are two types of loops.
1. Entry Controlled / Top tested/ Pre tested Loops.
In this type of loop the contions is tested first and the execute the set statements.
e.g
whitle(<condition>)
{
.
.
Set of statements
}


2. Exit controlled /  Bottom Tested / Post Tested loops.
In this type of loop the set of statement is executed first then condition is  tested.
e.g.
do
{
.
.
Set of statements
}
while(<Condition>);

In this type of loop the statement will be executed once even if conditon is false.

No comments:

Post a Comment

  A Potential Showdown: Kamala Harris vs. Donald Trump As the political landscape gears up for the next election cycle, the prospect of a fa...