Presentation is loading. Please wait.

Presentation is loading. Please wait.

Visual Basic.net Loops. Used to do multiple executions of the same block of code Do while loops Do until loops For next loops.

Similar presentations


Presentation on theme: "Visual Basic.net Loops. Used to do multiple executions of the same block of code Do while loops Do until loops For next loops."— Presentation transcript:

1 Visual Basic.net Loops

2 Used to do multiple executions of the same block of code Do while loops Do until loops For next loops

3 Do while loop (Syntax) Do while (condition) [loop instructions] Loop

4 Do while loop (example) Dim intCount as Integer ‘ declare local variable Intcount = 1 ‘ initialing counter to 1 Do while intCount <= 3 ‘ loop while count is <= 3 Print intCount ‘ print intCount to the printer intCount = intCount + 1 ‘ add 1 to intCount Loop ‘ redo the block of code until false

5 Do while (Flowchart) Start Declare intCount variable intCount = 1 intCount <= 3 Stop Display intCount intCount = intCount + 1 T

6 Do until loop (Syntax) Do [loop instructions] Loop until (condition)

7 Do until (example) Dim intCount as Integer ‘ declare a local variable intCount = 1 ‘ initializing counter to 1 Do ‘ redo block of code until false Print intCount ‘ print intCount to the printer intCount = intCount + 1 ‘ add 1 to intCount Loop until intCount > 3 ‘ loop until > 3

8 Do until (Flowchart) Start Declare intCount variable intCount = 1 Display intCount intCount = intCount + 1 intCount > 3 Stop T F

9 For Next Loop AKA an automatic counter loop Repeats a block of code statements a specified number of times

10 For Next (Syntax) For counter = startvalue to endvalue [Step stepvalue] [instructions] Next counter

11 For Next (Example) For intCount = 1 to 3 Step 1 ‘ initializing Print intCount ‘ prints out intCount Next intCount‘ loop

12 For Next (Flowchart) Start Declare intCount variable For for next loop Print intCount Stop 1 >3 intCount 1


Download ppt "Visual Basic.net Loops. Used to do multiple executions of the same block of code Do while loops Do until loops For next loops."

Similar presentations


Ads by Google