Question #68862

What is wrong with the following loop?

Dim intIndex As Integer = 10

Do While intIndex >= 10

lstBox.Items.Add("Hello")

intIndex += 2

Loop

It is an infinite loop
The test variable should not be changed within the loop itself
Nothing
It should have been written as a Do Until loop

Expert's answer

Answer:
It is an infinite loop. If you ever want to see “Hello”, replace ‘Do While intIndex >= 10’ with ‘Do While intIndex <= 10’

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS