How to | Use Brackets and Braces Correctly

The Wolfram Language's rich syntax uses different kinds of brackets and braces; familiarity with these aspects lets you read and program efficiently in the Wolfram Language.

Parentheses ( ), braces { }, and square brackets [ ] all have different meanings in the Wolfram Language. The first two are sometimes called round brackets and curly brackets.

You use parentheses ( ) in the Wolfram Language for grouping expressions and to determine the precedence of operations:


A list in the Wolfram Language is represented by braces { } and is a collection of items referred to as elements.

Create a list of the first five positive integers:

Anything in the Wolfram Language can be used in lists, including numbers, variables, typeset mathematical expressions, and strings:

Lists can contain other lists to create nested lists:

Square brackets are used in the Wolfram Language to enclose the arguments of functions.

The functions Range, Sin, and N are used here with square brackets enclosing their arguments:

The Wolfram Language uses double square brackets as the short form [[ ]] for the Part function, which is used to get parts of lists:


The various bracketing constructions can be used together.

Plot a function, with the range of the plot specified in a list:

The ability to use functions and lists together is seamlessly integrated in the Wolfram Language. Plot two functions togetherthe pair of functions is in a list:


All bracketing characters must be balanced for the Wolfram Language to evaluate an expression. When a bracketing character is unbalanced, the the Wolfram System 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.

  • The Four Kinds of Bracketing in Wolfram Language
  • Some General Notations and Conventions
  • The Syntax of the Wolfram Language
  • Input Syntax
  • Sequences of Operations
  • How to: Balance Brackets and Braces
  • How to: Use the Wolfram Language's Syntax
  • How to: Work with Lists
  • How to: Work with Variables and Functions
  • Wolfram Language Syntax
  • "How to" Topics