## section 1.5.2: Character Counting

page 18

Ignore the mention of efficiency with respect to nc = nc+1 vs. ++nc. Once you've gotten used to ++ meaning ``increment by 1,'' you'll probably find yourself preferring ++nc simply because it is more concise, and incrementing things by 1 is so common. (Personally, once I got used to it, I found ++ more natural, too, because after all, expressions like nc = nc+1, though they're common enough in programming, are very unnatural from an algebraic perspective.)

pages 18-19

You may find it odd to have a loop with no body, but such loops do crop up. Just make sure that the explicit null statement (or, if you prefer, empty {}) marking the empty loop body is plainly visible.

The whole first paragraph of page 19 counts as ``deep.'' A clean, well-designed loop will work properly for all of its ``boundary conditions'': zero trips through the loop, one trip, many trips, maximum trips (if there is any maximum, and if so, also maximum minus one). If a loop for some reason doesn't work at a particular boundary condition, it's tempting to claim that that condition is rare or impossible and that the loop is therefore okay. But if the loop can't handle the boundary condition, why can't it? It's probably awkwardly constructed, and straightening it out so that it naturally handles all boundary conditions will usually make it clearer and easier to understand (and may also remove other lurking bugs).

Read sequentially: prev next up top