Kotlin was designed from the start to be 100% compatible with Java and the Java ecosystem. See how to work with Kotlin and Java together in a single project and how to call back and forth between…
Android & Kotlin
Chapter in Kotlin Apprentice
Scripting with Kotlin
Feb 27 2021 · Chapter
Kotlin is not just useful on Android or the JVM, but also can be used for scripting at the command line. See how to use Kotlin as a scripting language…
Android & Kotlin
Chapter in Kotlin Apprentice
Your Kotlin Development Environment
Feb 27 2021 · Chapter
…quick-start introduction to Kotlin and how to use IntelliJ IDEA to work with the projects through this book…
Android & Kotlin
Chapter in Kotlin Apprentice
Kotlin Multiplatform
Feb 27 2021 · Chapter
…creating a project with a shared Kotlin module, you can share Kotlin code between multiple platforms. See how to create a Multiplatform project for iOS and Android, and use the expect and actual keywords for platform-specific behavior…
Android & Kotlin
Chapter in Kotlin Apprentice
Kotlin/Native
Feb 27 2021 · Chapter
Install and become familiar with the Kotlin/Native tools that compile Kotlin code to native binaries for iOS and other platforms…
Android & Kotlin
Kotlin Apprentice
Feb 27 2021 · Book
…complete beginners to Kotlin. No prior programming experience necessary! This is a book for complete beginners to the new, modern Kotlin language. Everything in the book takes place in a clean, modern development environment, which means you can focus on the core features of programming in the Kotlin language, without…
Android & Kotlin
Chapter in Kotlin Apprentice
Expressions, Variables & Constants
Feb 27 2021 · Chapter
…second chapter, you’re going to learn a few basics. You’ll learn how code works first. Then, you’ll start your adventure into Kotlin by learning some basics such as code comments, arithmetic operations, constants and variables. These are some of the fundamental building blocks of any language…
Android & Kotlin
Chapter in Kotlin Apprentice
Types & Operations
Feb 27 2021 · Chapter
…convert it to another. The naïve way to attempt this would be like so: var integer: Int = 100 var decimal: Double = 12.5 integer = decimal Kotlin will complain if you try to do this and will spit out the following error: Type mismatch. Required: Int Found: Double Some programming languages aren…
Android & Kotlin
Chapter in Kotlin Apprentice
Objects
Feb 27 2021 · Chapter
Kotlin has a special keyword, object, that makes it easy to follow the Singleton pattern in your projects, and is used to create properties specific to a class and not its instances. You also use the keyword to create anonymous classes…
Android & Kotlin
Chapter in Kotlin Apprentice
Kotlin Coroutines
Feb 27 2021 · Chapter
Kotlin coroutines allow you to simplify your asynchronous code and make it much more readable. You'll learn the difference between threads and coroutines and see examples of coroutines…
Android & Kotlin
Chapter in Kotlin Apprentice
Advanced Classes
Feb 27 2021 · Chapter
…earlier chapter introduced you to the basics of defining and using classes in Kotlin. Classes are used to support traditional object-oriented programming. Class concepts include inheritance, overriding, polymorphism and composition which makes them suited for this purpose. These extra features require special consideration for construction, class hierarchies, and understanding…
Android & Kotlin
Chapter in Kotlin Apprentice
Functional Programming
Feb 27 2021 · Chapter
Kotlin goes beyond just being an object-oriented programming language, and provides many of the constructs found in the domain of functional programming. See how to treat functions as first-class citizens by learning how to use functions as parameters and return values from other functions…
Android & Kotlin
Chapter in Kotlin Apprentice
Basic Control Flow
Feb 27 2021 · Chapter
…comparison operators. When you perform a comparison, such as looking for the greater of two numbers, the answer is either true or false. Kotlin has a data type just for this! It’s called a Boolean, after a rather clever man named George Boole who invented an entire field…
Android & Kotlin
Chapter in Kotlin Apprentice
Generics
Feb 27 2021 · Chapter
…only one place where those things are actually being done, and only one place where they could possibly break. A really helpful feature of Kotlin for this is called generics. The general concept of generic programming is that you don’t necessarily need to know exactly what type an object…
Android & Kotlin
Chapter in Kotlin Apprentice
Arrays & Lists
Feb 27 2021 · Chapter
Arrays and lists are the most common collection types you’ll run into in Kotlin. They both are typed like regular variables and constants, and store multiple values in a single data structure. See how to iterate through arrays and lists and how to modify their contents…
Android & Kotlin
Chapter in Kotlin Apprentice
Enum & Sealed Classes
Feb 27 2021 · Chapter
…note that both pronunciations are used commonly, and people tend to feel quite strongly about which pronunciation is the “correct” one. Caveat coder. In Kotlin, as in many other programming languages, an enum is its own specialized type, indicating that something has a number of possible values. One big difference…
Android & Kotlin
Chapter in Kotlin Apprentice
Conventions & Operator Overloading
Feb 27 2021 · Chapter
Kotlin is known for its conciseness and expressiveness, which allows you to do more while using less code. Support for user-defined operator overloading is one of the features that gives Kotlin, and many other programming languages, this ability. In this chapter, you’ll learn how to efficiently manipulate data…
Android & Kotlin
Chapter in Kotlin Apprentice
Interfaces
Feb 27 2021 · Chapter
…learned about two Kotlin custom types: Classes and objects. There’s another custom type that’s quite useful: Interfaces. Unlike the other custom types, interfaces aren’t anything you instantiate directly. Instead, they define a blueprint of behavior that concrete types conform to. With an interface, you define a common…
Android & Kotlin
Chapter in Kotlin Apprentice
Introduction
Feb 27 2021 · Chapter
Kotlin language has been around since 2011, but its popularity took off in 2017 when Google announced Kotlin’s inclusion as a first-class language for Android development. In 2019, Google announced a “Kotlin-first” approach to Android development. With modern and expressive language characteristics such as those found…
Android & Kotlin
Chapter in Kotlin Apprentice
Lambdas
Feb 27 2021 · Chapter
…previous chapter taught you about functions. But Kotlin has another construct you can use to break up code into reusable chunks: lambdas. These have many uses, and become particularly useful when dealing with collections such as a list…