

Sometimes, it’s useful to be able to represent the absence of a value. By the end of this chapter, you’ll know why you need nullable types and how to use them safely. This chapter will introduce you to nullable types, which allow you to represent not just a value, but also the absence of a value.

That’s one of the built-in safety features of Kotlin: If the type says Int or String, then there’s an actual integer or string there - guaranteed. It could have been an empty string, like "", but nevertheless, there was a value to which you could refer. When you had a string variable, like var name, it had a string value associated with it, like "Joe Howard". 24.6 Getting information from the systemĪll the variables and constants you’ve dealt with so far have had concrete values.22.6 Delegated properties as conventions.21.3 First-class and higher-order functions.

