Kotlin Print And Println
Chapter:
Kotlin
Last Updated:
22-09-2018 06:12:09 UTC
Program:
/* ............... START ............... */
fun main(args : Array<String>) {
/* Showing the difference between print and println statement in Kotlin */
println("1. println ");
println("2. println ");
print("1. print ");
print("2. print");
val value = 8783.8
println("Value")
println("$value")
println(value)
println("Value = $value")
println("${value + value}")
println(8783.8)
}
/* ............... END ............... */
Output
1. println
2. println
1. print 2. printValue
8783.8
8783.8
Value = 8783.8
17567.6
8783.8
Notes:
-
As like System.out.println() in java println is used to print output to screen in Kotlin.
- These two functions println() and print() functions to send output to the standard output in Kotlin.
- print() - prints string inside the quotes.
- println() - As like print() it will print the string inside the quote and the cursor moves to the beginning of the next line.
- Refer kotlin program to get more understanding about print and println.
Tags
Kotlin,Print And Println , Kotlin Basic Input/Output, kotlin print to console, kotlin print example,kotlin print newline