Hi all. Are there any simple built-in possibility ...
# getting-started
e
Hi all. Are there any simple built-in possibility to iterate over a List<T> in the reverse order? I know about syntax like this for the ranges:
for (i in 4 downTo 1)
but I want to iterate over List<T> like this one:
val names = listOf("bob", "ben", “nick”)
for (i in names downTo) {
// i == "nick" on the first iteration
}
It seems I can't do it with range-loop, only with old "while" loop. Am I right?