hopr
hopr copied to clipboard
Little mistake 9.4 Lookup Tables
In section 9.4 Lookup Tables
in "As in Case 1, you could write an if
tree that handles each combination of cherries, but just like in Case 1, this would be an inefficient solution" there is a problem in:
if (cherries == 2) {
prize <- 5
} else if (cherries == 1) {
prize <- 2
} else {}
prize <- 0
}
I think the correct code is:
if (cherries == 2) {
prize <- 5
} else if (cherries == 1) {
prize <- 2
} else {
prize <- 0
}
Yup. That explains why the last } is red!