7.LOOPS

Enough if computer’s hardware study! 🙂
Now we will overesme on journey of learning
Pure programming studying different concepts – Flowers like wild stuff came with cache – Build the computer hardware (RAM, cows) at many places during studying – crystal clear understanding and becomes a great programmer & not just a good programmer

Quote: Don’t run after success. Run towards excellence & success will follow the suit.

=> What is loop?
Well, start asking yourself what is loop in real life.
Have a loop at this pic from central yall

whatsapp image 2026 05 20 at 5.26.37 pm

This man has clone rarest of the rare crime. The judge has sentenced him- to be hanged till death! Who’s will the be hanged? He will be hanged by a rope made curved. The volume of the rope (circular) in which he need


will be put around his neck is called a loop.
Hence, there is loop.

lops


A is the point from where if an any steel along the rope in clockwise or anti-clockwise direction will again occur to A. The arc can trace infinite rounds of this loop as it wants all it get tired.

Similarly, in almost all programming languages there would be artificial when we use the computer run a statement more often one time. That is where loop come into the picture.

suppose, we want computer to display our name 10 times on the screen. One way could if instruct computer to do 10 will be —

public class NamePrint

PSUM (String [] args)
{
1tm SOP (“My name is jidepurtee”)
1
1&4ms SOP (“My name is jidepurtee”)
3


else if (variable)
We will no O. We will initially
be null think for name_value
We will variable add 1 to the value of money
What 100,000
by ne. Our name is we level
and we will stop printing ourname

Take breaks these dividends into computer with different program
three. is demonstrated below in the implementation
and if public class NamePrint

PSUM (String[] args)
{
int printing<counter-0;
do
{
SOP(“My name is jidepurtee”);
i while (printing<counter<10000)
if (no

Run this program, you will be amazed
to see the computer displaying your name 10 times
NOTE: Why have we taken the type of print_counter as ‘int’ because it 2 ‘int’ large values you 2, 14, 19,40,had 2 can easily precalculate to 10000 other… v…1, this is called double loop


will be put around his neck is called a loop.
Hence, there is loop —

A is the point from where if an any steel along the rope in clockwise or anti-clockwise direction will again occur to A. The arc can trace infinite rounds of this loop as it were all tied tied.

(buddy fuzzy)

Formally, in almost all programming languages there would be artificial when we use the computer run a statement more often one time. That is where loop come into the picture.

suppose, we want computer to display our name 10 times on the screen. One way could if instruct computer to do 10 will be —

public class NamePrint

PSUM (String [] args)
{
1tm SOP (“My name is jidepurtee”)
1
1&4ms SOP (“My name is jidepurtee”)
3


page Restoration from previous chapter
please pray religion to the space (vide)
i) program starts with class name
ii) every bracket is followed by curly bracket followed by curly bracket
iii) a program construct if you happen to travel in to a shell station
ii) Curly come across symbols
check telling & that after the
kinematics it itself (with lowercase (bracket)
Think if curly braces like that.
The curly bracket & if Hell that the
program running out before i is
crafty here it’ll all is getting
crased from here. similarly, it will have
its corresponding if signalend
df) The class NamePrint. you will come & consumed. here we
because there will be
to fill a region. is in glob sector
you saw all Signalland- Uhr seller.
Brgin steps km later ye see
a hair eff head brgin. That have
stuff hing is part of it Ll
is encneted o Ilight. ell so next
nd ye can letlet is
“a her eff herd ends” purs.i the. followed by arent beuler ends.


SOP (“: My name is jidepurtee”);
}

MAIS YOURSELF CONFIDENT
Run all those three programs & you
Using all those three contents, storing displayers are Hero No 1″
“g am Hero No 2”
“g am Hero No. 10000”

Think of problems are while involving loop – We would need program to solve those problems using loop we studied (2+4+6+….+100). So that the concept of loop gets ushered in you blood

We will read more concepts we will use programs involving on as more of those concepts.


We can also use the other two ways of implementing loops

=> While loop
class NamePrint
PSUM (Stry [] args)
{
int printing<counter=0;
while (printing<counter < 10000)
{
SOP(” name is jidepurtee”)
printing<counter++;
}
}

The difference between do while loop will start (Timer/4cas) –

  • Formed print you name first &
  • The circle then condition
  • Latte checks the condition & loop comes to rescue is satisfied

2) For – SOP
This is the simplest form of all there can find NamePrint
PSUM (Stry [] args)
{
for (int print<counter=0; print<counter < 10000; print<counter++)

Previous Article
Next Article