Function reference · Math

parens

Keeps parentheses around an expression in the output.

It doesn't change the value, only how the result is written.

Notation

parens(x)

Write it in an expression: nerdamer('parens(x+1)'), or in the Playground.

nerdamer.parens

nerdamer.parens(x: ExpressionInput): Expression

A method on the default import. Arguments can be strings, as in Notation.

Examples

Around a sum.

parens(x+1)
// → (1+x)
Open in Playground

Kept when multiplied.

2*parens(x+1)
// → 2*(1+x)
Open in Playground

Kept as the base of a power.

parens(a+b)^2
// → (a+b)^2
Open in Playground

← Back to Function reference