Home Segments Index Top Previous Next

67: Mainline

Of course, you can use parentheses either to circumvent the precedence rules or to make your intentions clearer. In the following, for example, the parentheses are not essential: the result produced without parentheses is the same as the result with parentheses. Nevertheless, many programmers insert parentheses anyway, just to make the expression's meaning absolutely clear:

6 + 3 * 2       <-- Value is clearly 18 
(6 + 3) * 2     <-- Value is even more clearly 18