Apple Game Frameworks and Technologies: Wrote binary, meant decimal (p 85)

At the bottom of page 85 is this info box:

By default, integer literals are expressed in decimal using the numbers 0 through 9. However, you can modify this default behavior and use binary literals instead, which might make it easier. With binary literals, you use the prefix 0b. Unlike integer literals, binary literals use only 0 and 1. So, in this example, 0b100 equals the number four. Essentially, this is shorthand for 000000100. If you choose to use binary literals, you’ll need to work in squares: 1, 2, 4, 8, 16, and so on.

The last sentence says If you choose to use binary literals, you’ll need to work in squares: 1, 2, 4, 8, 16, and so on. I think that’s a typo and was meant to read: “If you choose to use decimal literals…”

2 Likes