Last updated: 10/22/2018
- On page 74, an invocation of
runSimulation(String, (String, Int) -> String)
in Listing 5.8 is changed from Listing 5.7. It should be struckthrough. - On page 131, the following sentence is duplicated: “The read-only nature of the list has nothing to do with the
val
orvar
keyword you used to define the list variable. Changing the variable declaration forpatronList
fromval
(as it is defined now) tovar
would not change the list from read-only to writable. Instead, you would be able to reassign thepatronList
variable to hold a new, different list.” - In Chapter 13, a series of code listings shows a multi-line primary constructor without commas to delimit parameters.
- On page 193, the
castFireball
output begins referring to the glass of fireball as “delicious”, which does not appear in the function output previously. - On page 238, the argument to the when expression in the informal example below Figure 15.4 should be named
status
, notstudentStatus
. - On page 248, Listing 16.4 implements a random dice roll that suggests the idea of a zero-sided die. A more appropriate algorithm should include
Random().nextInt(diceSides) + 1
instead ofRandom().nextInt(diceSides + 1)
. - On page 279, Listing 18.16 should be labelled as contents of Player.kt, not Tavern.kt.