kotlin simple for loop
val names = listOf("Jack", "John", "Tim")
for(name in names){
println(name)
}
kotlin simple for loop
val names = listOf("Jack", "John", "Tim")
for(name in names){
println(name)
}
kotlin loop
var bubbles = 0
while (bubbles < 50) {
bubbles++
}
println("$bubbles bubbles in the water\n")
do {
bubbles--
} while (bubbles > 50)
println("$bubbles bubbles in the water\n")
repeat(2) {
println("A fish is swimming")
}
-> 50 bubbles in the water
49 bubbles in the water
A fish is swimmingA fish is swimming
kotlin for i in range how to get index value of i
val mylist = listOf("karate","taekwondo","sumo","boxing")
for ((index, value) in mylist.withIndex()) {
println("the element at $index is $value")
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us