// Numbers val answerToEverything: Int = 42 val jackPot: Int = 1_000_000 val poorApproximation: Double = 3.14 // Text val firstInitial: Char = 'N' val lastInitial: Char = 'D' val faveWord: String = "howdy" // Bundling values together data class Coordinate2D(val x: Int, val y: Int) val coordinateOrigin: Coordinate2D = Coordinate2D(0, 0) data class LabeledCoordinate2D(val location: Coordinate2D, val name: String) val faveRestaurant: LabeledCoordinate2D = LabeledCoordinate2D( location = Coordinate2D(1, 2), name = "Dishoom" ) // Small set of options val yes: Boolean = true val no: Boolean = false enum class TrafficLight { RED, YELLOW, GREEN, } val currentLight: TrafficLight = TrafficLight.RED val nextLight: TrafficLight = TrafficLight.GREEN sealed class Author { // don't know :( object Unknown: Author() // known human data class FullName( val firstName: String, val lastName: String ): Author() // tricksy! data class Pseudonym( val knownAs: FullName, val realName: FullName ): Author() } val authorUnknown: Author = Author.Unknown val authorCarl: Author = Author.FullName("hank", "green") val authorACMW: Author = Author.Pseudonym( knownAs = Author.FullName( firstName = "mary", lastName = "westmacott" ), realName = Author.FullName( firstName = "agatha", lastName = "christie" ), )