# 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**.

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` and press `9` (`Shift`+`9`) at the top of the keyboard. To type a close parenthesis, hold `Shift` and press `0` (zero) (`Shift`+`0`).

Doing the Alt code `Alt`+40 can also create an open parenthesis and `Alt`+41 creates a close parenthesis.

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 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 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 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 capture text. For example, in the following Perl regular expression, 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)

## Parenthesis vs parentheses

Parenthesis describes a single "(" or ")" mark and is considered singular. Parentheses is the plural version that describes both the "(" and ")" marks. For example, in the sentence below, "random access memory" is contained in parentheses.

RAM (random-access memory) is a type of computer memory that stores information temporarily.

Keyboard terms, Number key, Programming terms, Punctuation, Shift+0, Shift+1, Typography terms