answersLogoWhite

0

Bounded loops are also known as counting loops because they will iterate a pre-determined number of times before terminating. For example:

for x=1 to 15

print x

next x

Here, the variable x is incremented by 1 at the end of each iteration, thus the loop execute 15 times in total.

Unbounded loops are not defined by a specific count, but by some other condition. Unbounded loops are often called infinite loops, however there must always be an exit condition that is reachable.

x = rand()

while x<>0

print x

x = rand()

end while

Here, x is set to some random value. So long as x is non-zero, its value will print and x will be set to another random value. The loop may not execute at all (if x is initially zero), but once started it is not known how many times it will iterate until the exit condition is satisfied.

User Avatar

Wiki User

9y ago

Still curious? Ask our experts.

Chat with our AI personalities

SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra

Add your answer:

Earn +20 pts
Q: What is the difference between bounded loop and unbounded loop in programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp