Back to questions
JuniorTheoryCommon
What happens when you build and run this program?
fun main() {
println("a")
printn("b")
println("c")
}It does not compile, and nothing is printed
- Expecting
abefore the error: the compiler checks the whole file first, so a typo anywhere means no program is built and not one line runs. - Expecting the broken line to be skipped: the compiler does not leave out a line it cannot understand; it refuses to build the whole file.
- What does the program print once
printnis changed toprint? - How does a run-time error, such as
"12x".toInt(), differ from this one?