4 kotlin之for循环
var names = arrayOf("a", "b", "c")
//1
for (name in names)
println("3 $name")
//2
for (i in names.indices)
println("4 $i $names[i]")
//3
for ((index, name) in names.withIndex())
println("5 $index $name")
//4
for (index in 1..5) {
println("X $index")
}
image
喜欢可以加Q群号:874826112,一起学习,成长,交流工作经验,
记得要点赞,评论哦😯;
简书: https://www.jianshu.com/u/88db5f15770d
网友评论