Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
for with index
var languages = arrayOf("Java", "Kotlin", "Scala", "C#")
for (item in languages)
println(item)
var desserts = arrayOf("Cupcake", "Ice cream", "Eclair", "Pie")
for (item in desserts.indices) {
if (desserts[item].length > 4)
println(desserts[item])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment