Wrapped in a Function
In reality, though, there is a bit more to this Kotlin code than what you will initially see.
When you see an “Expand” button above the code, that means some of the code is being hidden from view, to focus your attention onto some specific set of lines. Clicking the “Expand” button will show the entire bit of Kotlin that we are executing:
fun main() {
println("hello, world!")
}
This main()
function works similarly to the static main()
method in a Java program, indicating the function that should be called to run the Java program.
Each of the Klassbook snippets has a main()
function. Sometimes the full Kotlin snippet will be visible in the page, and there will be no “Expand” button. Other times, the main()
function will be hidden, but the “Expand” button will show the full snippet, not just one portion.
Prev Table of Contents Next
This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.