Kotlin is an actively used programming language created in 2011.

8Years Old 61,446Users 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
  foo()?.bar()?.baz()
Edit

Last updated February 11th, 2019