Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Little mistake 9.4 Lookup Tables #29

Open
luifrancgom opened this issue Mar 30, 2020 · 1 comment
Open

Little mistake 9.4 Lookup Tables #29

luifrancgom opened this issue Mar 30, 2020 · 1 comment

Comments

@luifrancgom
Copy link

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
}
@arencambre
Copy link

Yup. That explains why the last } is red!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants