O'Reilly logo

Code Complete, Second Edition by Steve McConnell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Laying Out Control Structures

The layout of some program elements is primarily a matter of aesthetics. Layout of control structures, however, affects readability and comprehensibility and is therefore a practical priority.

Cross-Reference

For details on documenting control structures, see "Commenting Control Structures" in Commenting Techniques. For a discussion of other aspects of control structures, see Chapter 14 through Chapter 19.

Fine Points of Formatting Control-Structure Blocks

Working with control-structure blocks requires attention to some fine details. Here are some guidelines:

Avoid unindented begin-end pairs. In the style shown in Example 31-24, the begin-end pair is aligned with the control structure, and the statements that begin and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required