What is the output of the following code?
fun main() {
val list = listOf(1, 2, 3, 4, 5)
for (num in list) {
println(num)
}
}
fun main() {
val list = listOf(1, 2, 3, 4, 5)
for (num in list) {
println(num)
}
}A. 1 2 2
B. 1 2 3 4 5
C. 5 4 3 2 1
D. 3 3 3 3
Answer: Option B
Related Questions on Kotlin Program
A. A new version of Java.
B. A JavaScript framework.
C. A statically-typed programming language for the JVM, Android, and browser.
D. A database management system.
Which platform does Kotlin primarily target?
A. Python Bytecode
B. JavaScript
C. JVM (Java Virtual Machine) Bytecode
D. PHP

Join The Discussion