Types
Variables and constants have a data type that you specify. The type describes the data that is held by a variable or constant and tells the compiler how type checking will be handled, a feature in Kotlin that prevents the assignment of the wrong kind of data to a variable or constant.
To see this idea in action, you are going to add a file to the Sandbox project you created in Chapter 1. Open IntelliJ. The Sandbox project will likely open automatically, because IntelliJ reopens your most recent project. If it does not, you can open Sandbox from the list of recent files on the lefthand side of the welcome dialog or by selecting File → Open Recent → Sandbox.
Begin by adding a new file to the project by right-clicking src in ...
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.
Read now
Unlock full access