Kotlin for beginners: The one with ‘Hello Kotlin’

Mohita Prakash
3 min readNov 9, 2020

Being a hardcore FRIENDS fan, I couldn’t find a better name for the Kotlin series which I want to share with all of you. I understand many of us have already learned and are expertise in Kotlin already by now. This series is for those who still want to learn Kotlin but don’t know where and how to start it. I’m here to make your journey a little easier. Better late than never. Not much theory, but just understanding of code snippets and what it does. I’ll be mostly focusing on Kotlin for Android after the basics section. Let’s begin !!

Kotlin is object-oriented, statically typed, general-purpose programming language developed by JetBrains. It can run on numerous platforms. It is based on Java, but better and simpler than java.

1) Set up Environment in Intellij IDEA

Here I will show how to set up environment in Intellij IDEA and Android Studio

a) Install Intellij IDEA by downloading .exe file from the below link

b) Create a new project

File > New > Project. Select Kotlin > JVM|IDEA > Next

Provide a project name. Eg:- MyFirstKotlinProject. Select project location and select project SDK as java 1.8 or higher. Click FINISH.

c) Create a Kotlin class/file

d) Select ‘File’ from the dialog and give some name to it. Eg: Main.kt

e) Type the below code and let’s run our project. It’s a basic ‘Hello’ printing Kotlin code snippet. Please name the fun as main() itself. No need to worry about snippet, I’ll explain it soon.

fun main(){
println("The one with Hello Kotlin")
}

f) Let’s run the program and check our environment setup is success or not

Click on the RUN button on the left numbering panel or Toolbar > Run or Alt+Shift+F10.

After running, if it prints our string in the console, then our set up is successful.

2) Set up Environment in Android Studio

Here I assume you have some experience with Android Studio and its components.

a) Create a new project by selecting default Activity as Empty Activity

Change the Language to Kotlin and select required minimum SDK. Click Finish. This will download all required Kotlin dependencies for initial setup.

That’s it folks. Our set up is ready. We are ready to go to the next step.

Photo by Mirko Blicke on Unsplash

--

--

Mohita Prakash

Mobile Application Engineer | Talks about tech, finance and fitness | Believes in simplicity | Day Dreamer