Separates the beginning and ending values of a For...Next loop counter that counts down from the start value to the end value. Can also be used to indicate a range of values in a Select Case.


You can get an infinite loop if you use a limited Integer type (UInt32 or UInt8) and your loop end value reach the minimum or maximum size of the Integer. In order for a loop to exit the counter, it has to go beyond the bounds of the loop's specified end value. For example if your end value is 0, but you used an UInt8 which has a minimum value of 0, then your loop counter can never be below 0 (it wraps to 255) and you will have an infinite loop.

Sample code

Count down to 1:

For i As Integer = 10 DownTo 1


All project types on all supported operating systems.

See also

For...Next, Select Case, To commands