There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "We introduced a new BakeryGood class, with the shared behavior and state of both Cupcake and Biscuit classes and we made both classes extend BakeryGood."
A block of code is set as follows:
open class BakeryGood(val flavour: String) {
fun eat(): String {
return "nom, nom, nom... delicious $flavour bakery good"
}
}
class Cupcake(flavour: String): BakeryGood(flavour)
class Biscuit(flavour: String): BakeryGood(flavour)
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
fun main(args: Array<String>) { val emptyList1 = listOf<Any>()
val emptyList2 = emptyList<Any>() println("emptyList1.size = ${emptyList1.size}") println("emptyList2.size = ${emptyList2.size}") }
Any command-line input or output is written as follows:
$ kotlin HelloKt
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "A dialog will appear that will ask whether you want to open it as a file or as a project. Click on Open As Project"