Download presentation
Presentation is loading. Please wait.
Published byReino Kokkonen Modified over 6 years ago
1
Introducing Do While & Do Until Loops & Repetition Statements
Tutorial 9 Introducing Do While & Do Until Loops & Repetition Statements
2
Do While Loop Do While [condition] action(s) Loop intCounter = 0
Do While (intCounter < 10) intSumOfNumbersUpto10 += intCounter intCounter += 1 Continue
3
Repeats the actions as long as the condition is true
The condition must change, otherwise infinite loop will occur. Within the loop add code(s) to change the condition that eventually become false
4
Do Until Loop Do Until [condition] action(s) Loop intCounter = 0
Do Until (intCounter >= 10) intSumOfNumbersUpto10 += intCounter intCounter += 1 Continue
5
Repeats the actions as long as the condition is false
The condition must change, otherwise infinite loop will occur. Within the loop add code(s) to change the condition that eventually become true
6
Coding with ListBox Remove items in the ListBox
lstStudents.Items.Clear( ) Class.SubClass.Behavior or Add items to the ListBox lstStudents.Items.Add (“Name” & ControlChars.Tab & ControlChars.Tab & “Course”)
7
Example Dim intCounter As Integer = 1
Dim intSumOfNumbersUpto10 As Integer = 0 Do While (intCounter < 10) intSumOfNumbersUpto10 += intCounter lstNumbersUpto10.Items.Add(“Number “ & intCounter & ControlChars.Tab & intSumOfNumbersUpto10) intCounter += 1 Loop
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.