Kotlin Output (Print Text)
Kotlin Output (Print)
The println()
function is used to output values/print text:
You can add as many println()
functions as you want. Note that it will add a new line for each function:
Example
fun main() {
println("Hello World!")
println("I
am learning Kotlin.")
println("It is awesome!")
}
Try it Yourself »
You can also print numbers, and perform mathematical calculations:
The print() function
There is also a print()
function, which is similar to println()
. The only difference is that it does not insert a new line at the end of the output:
Example
fun main() {
print("Hello World! ")
print("I
am learning Kotlin. ")
print("It is awesome!")
}
Try it Yourself »
Note that we have added a space character to create a space between the sentences.