Name: ()

Type: operator

Syntax: (<expression>)

Summary: <group|Groups> <operand|operands> together.

Introduced: 1.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Example:
get (quantity * priceEach) + shippingCost

Example:
("a" is within field 1) or ("b" is within field 2)

Example:
23 * ((4 / 17) + 60) + (- 7)

Parameters:
expression: Any LiveCode expression.

Description:
Use parentheses ( ) to group <operand|operands> together in order to control the order <operation|operations> are performed in, or to make the <control structure|structure> of a complex <expression> clearer.

When LiveCode evaluates an expression, operations enclosed within parentheses are performed first. If parentheses are nested, the expression within the innermost set of parentheses is evaluated first.

For example, the sin <function> is <evaluate|evaluated> before the / <operator>, so the sin of 1/4 means "take the sine of one, then divide by four". To obtain the sine of 1/4, use parentheses to force the division to be done first, as in this expression: the sin of (1/4).

Even when they are not needed to change operator precedence, parentheses are useful in making complex expressions more readable. For example,
  (quantity * priceEach) + (shippingCost * weight)
evaluates to the same number as
  quantity * priceEach + shippingCost * weight
But the first example is easier to understand,  because the parentheses break down the expression logically for the reader.

Parentheses in expressions must be used in pairs, each ( with a matching ). Use of <matched|unmatched> parentheses will cause a <compile error>.

References: [] (keyword), + (operator), - (operator), * (operator), value (function), matched (glossary), operand (glossary), operation (glossary), operator (glossary), group (glossary), expression (glossary), control structure (glossary), evaluate (glossary), compile error (glossary), function (control_st)

Tags: math
