For Loop with Negative Step | Quickie

Cannot believe that I’m writing some helpful examples using VB.Net, but that is the language that we’re using at work, so have to adapt now. Next find how to make a loop with a negative step (decreasing step):

Imports System

Public Class MainClass
 Shared Sub Main()
 For intCount As Integer = 10 To 1 Step -1
 'Add the item to the list
 System.Console.WriteLine(intCount)
 Next
 End Sub
End Class

5 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *