How to | Balance Brackets and Braces
All bracketing characters in the Wolfram Language must be balanced. That is, every type of opening bracket must be balanced by a corresponding closing bracket. If there is an imbalance, then the Wolfram System will not evaluate the cell. The Wolfram System front end contains several convenient tools that let you make sure that your brackets and braces are balanced.
If you try to evaluate an unbalanced expression, the Wolfram Language produces an error and highlights the location of the error. The cell bracket on the far right is also highlighted; it displays a + symbol that you can click to get more information about the error. In this case, no additional information is available, so clicking + does nothing:
When you type a closing bracket, the Wolfram System front end colors the matching opening bracket black and also momentarily highlights it. This helps you to see which bracketing symbols were just balanced:
The Wolfram System front end contains a menu item that is useful in these situations. With your cursor in the unbalanced expression, go to Edit ▶ Extend Selection. The contents of the nearest matching pair of brackets are now selected. You can also do this by simply double-clicking in the unbalanced expression:
The position of the cursor is important when using Edit ▶ Check Balance. It will not work when the cursor is placed before an unbalanced bracketing character, because there is no balanced set of bracketing characters to select: