How to | Use Brackets and Braces Correctly
Mathematica's rich syntax uses different kinds of brackets and braces; familiarity with these aspects lets you read and program efficiently in
Mathematica.
Parentheses ( ), braces { }, and square brackets [ ] all have different meanings in
Mathematica. The first two are sometimes called round brackets and curly brackets.
You use parentheses

in
Mathematica for grouping expressions and to determine the precedence of operations:
| Out[53]= |  |
| Out[54]= |  |
A list in
Mathematica is represented by braces

and is a collection of items referred to as elements.
Create a list of the first five positive integers:
| Out[5]= |  |
Anything in
Mathematica can be used in lists, including numbers, variables, typeset mathematical expressions, and strings:
| Out[17]= |  |
Lists can contain other lists to create nested lists:
| Out[18]= |  |
Square brackets are used in
Mathematica to enclose the arguments of functions.
The functions
Range,
Sin, and
N are used here with square brackets enclosing their arguments:
| Out[45]= |  |
| Out[2]= |  |
| Out[46]= |  |
Mathematica uses double square brackets as the short form

for the
Part function, which is used to get parts of lists:
| Out[3]= |  |
| Out[5]= |  |
The various bracketing constructions can be used together.
Plot a function, with the range of the plot specified in a list:
| Out[48]= |  |
The ability to use functions and lists together is seamlessly integrated in
Mathematica. Plot two functions together—the pair of functions is in a list:
| Out[49]= |  |
All bracketing characters must be balanced for
Mathematica to evaluate an expression. When a bracketing character is unbalanced, the
Mathematica front end colors it purple:
Attempting to evaluate the expression produces an error:
For more information on balancing brackets and braces, see
How to: Balance Brackets and Braces.