Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 61 Example : For … To… Step For index = 0 To n Step s lstValues.Items.Add(index) Next Control variable Start value Stop value Amount to add to.

Similar presentations


Presentation on theme: "Chapter 61 Example : For … To… Step For index = 0 To n Step s lstValues.Items.Add(index) Next Control variable Start value Stop value Amount to add to."— Presentation transcript:

1 Chapter 61 Example : For … To… Step For index = 0 To n Step s lstValues.Items.Add(index) Next Control variable Start value Stop value Amount to add to index

2 Chapter 62 Example with Positive Step Dim j As Integer For j = 1 To 10 Step 2 lstBox.Items.Add(j) Next lstBox.Items.Add("Blastoff")

3 Chapter 63 Example with Negative Step Dim j As Integer For j = 10 To 1 Step -1 lstBox.Items.Add(j) Next lstBox.Items.Add("Blastoff")

4 Chapter 64 Non-integer Step Values Can lead to round-off errors with the result that the loop is not executed the intended number of times.

5 Chapter 65 Non-integer Step Example A loop beginning with For i As Double = 1 To 2 Step 0.1 will be executed only 10 times instead of the intended 11 times. It should be replaced with For i As Double = _ 1 To 2.01 Step 0.1

6 Chapter 66 Example A loop beginning with For i As Double = 1 To 2 Step 0.1 will be executed only 10 times instead of the intended 11 times. It should be replaced with For i As Double = _ 1 To 2.01 Step 0.1

7 Chapter 67 Lab 6.7 For Loop with Different Step Try Lab 6.7 to discover the characteristics of For … Next Loop


Download ppt "Chapter 61 Example : For … To… Step For index = 0 To n Step s lstValues.Items.Add(index) Next Control variable Start value Stop value Amount to add to."

Similar presentations


Ads by Google