Kotlin is an actively used programming language created in 2011. Kotlin is a statically-typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure. Its primary development is from a team of JetBrains programmers based in Saint Petersburg, Russia. While the syntax is not compatible with Java, Kotlin is designed to interoperate with Java code and is reliant on Java code from the existing Java Class Library, such as the collections framework. Read more on Wikipedia...

8Years Old 35,876Users 32Jobs

Example code from the Hello World Collection:

// Hello world in Kotlin

fun main(args : Array<String>) {
    println("Hello, world!")

Example code from Linguist:

package addressbook

class Contact(
  val name : String,
  val emails : List<EmailAddress>,
  val addresses : List<PostalAddress>,
  val phonenums : List<PhoneNumber>

class EmailAddress(
  val user : String,
  val host : String

class PostalAddress(
  val streetAddress : String,
  val city : String,
  val zip : String,
  val state : USState?,
  val country : Country
) {
   assert {(state == null) xor (country == Countries["US"]) }

class PhoneNumber(
  val country : Country,
  val areaCode : Int,
  val number : Long

object Countries {
  fun get(id : CountryID) : Country = countryTable[id]
  private var table : Map<String, Country>? = null
  private val countryTable : Map<String, Country>
    get() {
      if (table == null) {
        table = HashMap()
        for (line in TextFile("countries.txt").lines(stripWhiteSpace = true)) {
          table[line] = Country(line)
      return table

class Country(val name : String)

Example code from Wikipedia:

// returns null if...
  // - foo() returns null,
  // - or if foo() is non-null, but bar() returns null,
  // - or if foo() and bar() are non-null, but baz() returns null.
  // vice versa, return value is non-null if and only if foo(), bar() and baz() are non-null

Last updated August 22nd, 2019