Kotlin intro

This is a repo that I (Linus) use for a curse and that contains some examples on how to do som basics things in kotlin. And a couple of task (and examples on how to solve them) to practice different things in kotlin.

If you don't know where to look my tips it to go through the examples and test one by one, and do the task connected to each of them (found in the link below the list).

  1. Geting started - "hello world" and how to run it here
  2. Intro to syntax here
  3. Classes here
  4. Null and types here
  5. Working on a list here
  6. Extra here

All the parts have a task to try/test the ideas out that can be found here.

What is Kotlin

Kotlin is a general purpose programing language

inspiration from (but not limited to):

  • Java
  • Scala
  • C#
  • Groovy

Multi-paradigm: object-oriented, functional, imperative, block structured, declarative, generic, reflective, concurrent

That is statically typed

Runs on

  • JVM (Java Virtual Machine)
    • Kotlin is designed with Java interoperability in mind.
  • JS (JavaScript)
  • Native (native binaries for various architectures)

Some basics

Types

  • var
  • val

Built in types

  • kotlin.
    • Int
    • Short
    • Byte
    • Long
    • String
    • Array And some more.

No primitive types exist everything is objects even if those above is a bit "magick"

Let's build an application