for loop shorthand kotlin code example
Example 1: kotlin simple for loop
val names = listOf("Jack", "John", "Tim")
for(name in names){
println(name)
}
Example 2: kotlin if
if (a > b) {
max = a
} else {
max = b
}
val names = listOf("Jack", "John", "Tim")
for(name in names){
println(name)
}
if (a > b) {
max = a
} else {
max = b
}