DownTo

From Xojo Documentation

Language Keyword

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.

Notes

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
...
Next

See Also

For...Next, Select Case, To commands