loading...
Cover image for Hello World in Kotlin

Hello World in Kotlin

jay_tillu profile image Jay Tillu😎 ・2 min read

Hello World is an introductional program in every language. Usually, it is the best way to introduce to the language. It shows the basics of the language like its syntax, basic working, and functionalities, etc. Here I just show you Hello World in kotlin.

fun main(args: Array<String>) {
    print("Hello World")
}
  • fun main (args: Array<String>) {…} — This is a main function, which is mandatory in every kotlin application. The compiler starts execution from main function. You can also call it as Entry Point of Every Kotlin Program. This function takes an array of string as arguments.

  • funfun is a keyword, used to show that this is a function. In this case, main is a function.

  • print () — The print() function is an inbuilt function that prints the value inside it. You can print values, calculation’s results, etc.

  • println () — The println() function also works same as print() but it also prints a newline after the output. So if you have the next output then it will go to the next line. If nothing has to print it will print a blank line. Many legacy languages like C and C++ miss this function, in those languages we still walk with \n, although it's really handy and useful.

  • As you can guess, the semicolon is optional. The compiler is smart enough to understand that newline is the end of the statement.

So, guys, that’s it for Hello World. Feel free to ask for any queries.

Till then Keep Coding, Keep Loving.

Wanna get in touch with me? Here are the links. I’ll love to become your friend. 😊
Twitter
Facebook
Instagram
Medium
or just mail me at jayviveki13@gmail.com

Posted on by:

jay_tillu profile

Jay Tillu😎

@jay_tillu

🌏 विधायास्य धमॅस्य संरक्षणम् 🌍 ☀️ Society before Self ☀️ 🙏🏻 Humanism by Religion 🙏🏻 💻 Work for Mankind 💻 🌐 Believes in वसुधैव कुटुम्बकम् 🌐

Discussion

pic
Editor guide