Created
November 17, 2019 21:40
-
-
Save magdamiu/69f58c9faf51a37b28c68a9c8026995f to your computer and use it in GitHub Desktop.
for with index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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