Skip to Content
Kotlin in Action
book

Kotlin in Action

by Svetlana Isakova, Dmitry Jemerov
February 2017
Intermediate to advanced content levelIntermediate to advanced
360 pages
11h 55m
English
Manning Publications
Content preview from Kotlin in Action

Chapter 2. Kotlin basics

This chapter covers

  • Declaring functions, variables, classes, enums, and properties
  • Control structures in Kotlin
  • Smart casts
  • Throwing and handling exceptions

In this chapter, you’ll learn how to declare in Kotlin the essential elements of any program: variables, functions, and classes. Along the way, you’ll get acquainted with the concept of properties in Kotlin.

You’ll learn how to use different control structures in Kotlin. They’re mostly similar to those that are familiar to you from Java, but enhanced in important ways.

We’ll introduce the concept of smart casts, which combine a type check and a cast into one operation. Finally, we’ll talk about exception handling. By the end of this chapter, you’ll be able ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kotlin in Action, Second Edition

Kotlin in Action, Second Edition

Roman Elizarov, Svetlana Isakova, Sebastian Aigner
Java to Kotlin

Java to Kotlin

Duncan McGregor, Nat Pryce
Head First Kotlin

Head First Kotlin

Dawn Griffiths, David Griffiths

Publisher Resources

ISBN: 9781617293290Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link