Answer to Question #68862 in Visual Basic for Jonathan Doan
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
1
2017-06-16T08:31:09-0400
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!
Comments
Leave a comment