2.1. Bracketing
When setting out a code block, use the K&R[*] style of bracketing. That is, place the opening brace at the end of the construct that controls the block. Then start the contents of the block on the next line, and indent those contents by one indentation level. Finally, place the closing brace on a separate line, at the same indentation level as the controlling construct.
Likewise, when setting out a parenthesized list over multiple lines, put the opening parenthesis at the end of the controlling expression; arrange the list elements on the subsequent lines, indented by one level; and place the closing parenthesis on its own line, outdenting it back to the level of the controlling expression. For example: my @names = ( 'Damian', Don't place the opening brace or parenthesis on a separate line, as is common under the BSD and GNU styles of bracketing: # Don't use BSD style... my @names = ( 'Damian', # Primary key 'Matthew', # Disambiguator 'Conway', # General class or category ); for my $name (@names) { for my $word (anagrams_of(lc $name)) { print "$word\n"; } } # And don't use GNU style either... for my $name (@names) { for my $word (anagrams_of(lc $name)) { print "$word\n"; } } The K&R style has one obvious advantage over the other two styles: it requires one fewer line per block, which means one more line of actual code will be visible at any time on your screen. If you're looking at a series of blocks, that might add up to three or four extra code lines per screen. The main counter-argument in favour of the BSD and GNU styles is usually that having the opening bracket[*] on its own line makes it easier to visually match up the start and end of a block or list. But this argument ignores the fact that it's equally easy to match them up under K&R style. You just scroll upwards until you "bump your head" on the overhanging control construct, then scroll right to the end of the line.
Or, more likely, you'd just hit whatever key your editor uses to bounce between matched brackets. In vi that's %. Emacs doesn't have a native "bounce" command, but it's easy to create one by adding the following to your .emacs file[]:
|