Writing Your First Kotlin Program - Hello, World!

Congratulations on taking your first step into the world of Kotlin programming! In this guide, we'll walk you through writing your first Kotlin program, which is the classic "Hello, World!" program. This will help you get familiar with the basic syntax and structure of Kotlin.

1. Set Up Your Development Environment

Before you start writing Kotlin code, ensure you have your development environment ready. If you haven't set it up yet, please refer to the guide on Setting Up Your Kotlin Development Environment.

2. Create a Kotlin Project

Open your preferred Kotlin development environment, such as IntelliJ IDEA. Then, create a new Kotlin project following these steps:

  1. Open IntelliJ IDEA.
  2. Click "Create New Project" or "File" → "New" → "Project..."
  3. Select "Kotlin" as the project type.
  4. Configure your project settings, like project name and location, and click "Finish."

3. Write Your "Hello, World!" Program

Now that you have your project set up, it's time to write your first Kotlin code. Follow these steps:

  1. In IntelliJ IDEA, navigate to the "src" folder in your project's directory.
  2. Create a new Kotlin file (e.g., "HelloWorld.kt").
  3. Open the file and enter the following Kotlin code:
fun main() {
println("Hello, World!")

4. Run Your Program

To see your "Hello, World!" program in action, follow these steps:

  1. Right-click on your Kotlin file in IntelliJ IDEA.
  2. Select "Run HelloWorldKt."

You should see the output in the console:

Hello, World!

5. Congratulations!

You've just written and executed your first Kotlin program. This simple "Hello, World!" program is the starting point for your Kotlin journey. From here, you can explore Kotlin's features, build more complex applications, and become a proficient Kotlin developer.


Writing your first Kotlin program is an exciting step in your programming journey. You've learned the basic structure of a Kotlin program, and you're now ready to explore more advanced Kotlin features and start building your own applications.

Happy coding!