package ControlFlow /** * https://www.tutorialspoint.com/kotlin/kotlin_for_loop.htm */ class ForStatements { fun main1(args: Array) { for (item in 1..5) { println(item) } } fun main2(args: Array) { for (item in 5 downTo 1 step 2) { println(item) } } fun main3(args: Array) { var fruits = arrayOf("Orange", "Apple", "Mango", "Banana") for (item in fruits) { println(item) } } fun main4(args: Array) { var fruits = arrayOf("Orange", "Apple", "Mango", "Banana") for (index in fruits.indices) { println(fruits[index]) } } }