Kotlin Code Demos
To display a message on the output console, use either the print(...)
function, or the println(...)
function...
print(...)
The print(...)
function displays the given text, and then leaves the output position at the end of the text, ready for the next print message.
So this...
fun main() {
print("Hello...")
print("From...")
print("Kotlin!")
}
Will output this...
Hello...From...Kotlin!
println(...)
The println(...)
function (say 'print line') displays the given text, and then moves the output position down to the next line, ready for the next print message.
So this...
fun main() {
println("Hello...")
println("From...")
println("Kotlin!")
}
Will output this...
Hello...
From...
Kotlin!