# Parenthesis

A **parenthesis** is a punctuation mark used to enclose information, similar to a bracket. The **open parenthesis**, which looks like **(**, is used to begin **parenthetical text**. The **close parenthesis**, **)**, denotes the end of parenthetical text. The plural of parenthesis is **parentheses**.

Tip: Parentheses are also called **curved brackets**, especially outside of the United States.

## How to type parentheses

To type an open parenthesis on a U.S. keyboard, hold down the Shift key and press **9** at the top of the keyboard. To type a close parenthesis, hold Shift and press **0**.

To create a tilde on a smartphone or tablet, open the touch keyboard, switch to the numbers (123) or symbols (sym) section, and touch the "**(**" or "**)**" symbol.

## What are parentheses used for?

- In writing, parentheses can be used to express additional information, an aside, or special remarks. For instance, "The child received a stern lecture (and he deserved it)."
- In mathematical expressions, parentheses denote priority in the order of operations. Parts of the expression enclosed in parentheses are to be calculated first, and the result used in the rest of the expression. For instance, in this expression:

5 + 2 x 5 = 15

Multiplication is peformed before addition, according to the standard order of operations. However, in this expression:

( 5 + 2 ) x 5 = 35

The addition inside the parentheses is performed first, and the sum is then used in the rest of the expression. This kind of math expression, where the result depends upon the position of parentheses, is called non-associative.

- In many computer programming languages, parentheses have a special purpose. For example, they are frequently used to enclose arguments to functions and methods. In languages such as Lisp, parentheses are used to define an s-expression.
- In regular expressions, parentheses are used for pattern grouping and capturing.
- In spreadsheet applications such as Microsoft Excel, parentheses are used in formulas.
- When introducing an acronym for the first time that may not be known by the reader parentheses may be used to contain the full form. For example,
*HTML (Hypertext Markup Language)*.

## Parentheses in computer programming

Below is an example of how parentheses may be used in an if statement, using the Perl programming language.

if ($test =~ /[a-zA-z]/) { print "It works!\n"; }

## Regular expression parentheses

With regular expressions, parentheses can be used to capture text. For example, in the below regular expression done in Perl the variable $piglatin takes anything beginning with "th" and moves it to the end of the line.

$piglatin =~ s/^(th)(.*)/\2\1/i;

## Parentheses in spreadsheet formulas

The following example shows how a formula using parentheses may appear in Microsoft Excel. In the example below, the formula adds cells A1 through A5 to get a total sum.

=sum(a1:a5)