Kotlin - Prima Salto - Handson.txt - What is Kotlin Kotlin is a statically-typed programming language for modern multi-platform applications Kotlin was

Kotlin - Prima Salto - Handson.txt - What is Kotlin Kotlin...

This preview shows page 1 - 3 out of 14 pages.

What is Kotlin ?Kotlin is a statically-typed programming language for modern multi-platform applications.Kotlin was developed by JetBrains, a company acclaimed for developing tools for professionals.The foremost goal of Kotlin is to provide a concise, productive and safer alternative to Java.The most common areas to use Kotlin areBuilding server-side codeBuilding mobile applications that run on Android devicesWhy JetBrains created Kotlin ?To improve JetBrains productivity by switching to a more expressive language.JetBrains expect Kotlin to drive the sales of IntelliJ IDEA.JetBrains wanted to drive company's business as well as increase community awareness of JetBrains by keeping trust.FeaturesKotlin is Open Source, and is distributed under Apache License, Version 2.0100% interoperable with Java and AndroidConcise, reducing the lines of code by 40% compared to JavaExpressiveEasy to learnTool friendly letting to run in any Java IDESafe and eliminates the dangers of null references from the codeWhere is Kotlin Now ?Many companies like Corda, Uber, Trello, Pinterest and Evernote are using Kotlinalong with other programming languages to create applications.In the Google I/O held on 17 May 2017, Android team announced Kotlin as an official language for Android app development.Lines of Kotlin code increased from 2.1 million to 10 million in an interval of year from 2016 to 2017.Statistics shows approximately 160,000 users have already tried Kotlin.Possible Future Projects in KotlinFullstack app development.Cross-platform game development.Cross-platform mobile application development.Server-side and microservices.Data analysis and machine learning.Local Environment SetupAny popular Java IDE can be used to run Kotlin.The most popular among them is IntelliJ IDEA (Community Edition).The latest version of Intellij IDEA fully supports Kotlin without any plugin.Hello World ExampleLook at this simple code that prints "Hello World" :fun main(args : Array<String>) {println("Hello, World")}A Kotlin program basically consists of the following parts :
Background image
fun main(args : Array<String>) { ... }main function is a mandatory function, which is the entry point of every Kotlin program.The function takes array of strings as a parameter and returns Unit.println("Hello, World")The println() function prints the given message inside the quotation marks.VariablesKotlin implicitly identifies the data type of the variable from the initialization expression. This mechanism is called type inference.Kotlin has two keywords for declaring variables:valvarVariables - val and varval :Immutable variable.A val variable cannot be reassigned after it is initialized.It corresponds to a final variable in Java.val name = "kotlin"Here, the constant name cannot be reassigned to any other value again.
Background image
Image of page 3

You've reached the end of your free preview.

Want to read all 14 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture