For loop in Visual Basic

The For block is a basic ingredient in many programs. It allows you to repeat a block of code a set number of times, using a built-in counter.

Example

Module Module1

    Sub Main()

        Dim Number1 As Integer

        For Number1 = 3 To 7
            Console.WriteLine(Number1)
        Next

        Console.ReadLine()
    End Sub

End Module

Output

3
4
5
6
7
Share

You may also like...