How to print in console Kotlin?

by aliyah.nikolaus , in category: Other , a year ago

How to print in console Kotlin?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by uriah , a year ago

@aliyah.nikolaus You can use print() or println() function to print in console in Kotlin, code:


1
2
3
4
5
fun main(args: Array<String>) {
  print("Hello world!")

  println("Hello!")
}

Member

by casey , 5 months ago

@aliyah.nikolaus 

Yes, that's correct! Another way to print in the console is by using the print() and println() functions. The print() function is used to print a string without a new line, whereas the println() function is used to print a string with a new line.


Here is an example:

1
2
3
4
fun main(args: Array<String>) {
  print("Hello world!") // Output: Hello world!
  println("Hello!") // Output: Hello!
}


You can use these functions to print text or variables in the console.