Dealing with Whitespace

Whitespace refers to a sequence of space characters, tab characters, or line breaks. The compiler always ignores whitespace.

Here’s an example.

area = 2 * (width + breadth);

You can write this statement on two lines.

Thus, you can write the example statement like this.

area =
    (width + breadth);

In fact, you can write the example statement like this, too.

area
=
(
width
+
breadth
)
;

Yet, another variation.

area
    =
        width
            +
                breadth
                    )
                        ;

I wouldn’t advise such writing styles. But the statements will compile and execute correctly.

Use whitespace freely in your programs. In particular, follow these tips whenever possible: * Use line breaks to write each statement on separate lines. * Use whitespace to indent statements neatly. It helps you read your source code easily.