The downTo case

The downTo keyword enables developers to interact with the numbers in reverse order. The instruction is self-explanatory, as well. Let's see it in practice:

for (i in 5 downTo 1) {  println(i)}

It is pretty easy as well. The interaction will occur in the reverse order, in this case, the value 1 will be included. As we can see, the code is pretty easy to understand.

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.