Hello, Kotlin!

 

Kotlin Logo

Introduction

       Before I started learning Kotlin language, I learned the basics of Java language and OOP "Object-Oriented programming" concepts in Java. So once I started seeing the Syntax of Kotlin, I felt excitement and relieved as it is simpler than Java. Kotlin is known that it reduces boilerplate code, which is the code needed to be written in several places without any modification. 

About Kotlin

        These are the features of Kotlin that Google has selected that will make our lives, as developers, better, "well, I hope so 😄":
  • Kotlin is an open source language
  • Statically typed, object-oriented, modern programming language
  • Properties and extensions for classes
  • Created from developers to developers
  • Concise, much less boilerplate code than other languages
  • Increased null safety with nullable and non-nullable data types
  • Supports lambdas and higher-order functions
  • Fully compatible with Java language, so we can migrate over time and continue using our favourite libraries.
  • Officially supported for Android development 
SRC: Udacity Google Course

Your First Kotlin Function


    I can't really write a programming language article without you writing any code! This is how we write "Hello World" in Kotlin. First to write this code:
  • Open Android studio
  • Choose a new Empty Activity > Next > Name the project > Choose Kotlin Language > Finish
  • Click on tools  > Kotlin > Kotlin REPL
  • The REPL will appear in the window's bottom
  • Write the following 
Hello World kotlin code
  •  Press Ctrl + Enter to execute 

Hello World kotlin code


    The code explanation:

Hello World kotlin code explanation
    Congratulations! Now you wrote your first Kotlin code! 

New Terms Definitions Infographic 

New Terms Definitions Infographic

Download HD Infographic from Here


Null Vs Zero Vs Undefined Illustration

    To Understand the difference between Null, Zero, and undefined. Please check the next illustration.

Non-zero Vs zero Vs Null Vs undefined

Conclusion 

    Starting next blog post, I will summarize the concepts I learned while studying Kotlin Bootcamp for Programmers Udacity course. Google has created this course for intermediate programmers who have experience working with OOP languages such as Java language. For me, the course was quite challenging. So I decided to write several blog posts to explain Kotlin concepts and to act as a reference for me and for other code newbies. 

     Thank you for reading my post. You can subscribe to my blog or follow me on Twitter to be the first person to read my new posts.



2 Comments