Chapter 3Getting Started with Types
Although a formal definition of types is outside of the scope of this book, informally you can think of a type as a way of identifying some collection of different values. For example, the Bool type is a way of naming the set of values True and False; similarly, the Integer type is a way of naming the set of all the whole numbers. To be precise, you can say the values True and False inhabit the type Bool, or they are its inhabitants, although informally throughout this book we’ll simply say “True is a Bool.”
Every value has a type, whether it’s a number, some text, or a function. The way the value was created doesn’t matter; a literal value of True defined at the top level of the program, returned by a function, ...
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