Lingo Dictionary > Symbols > () (parentheses) |  |

() (parentheses)

Syntax

    (expression)

Description

Grouping operator; performs a grouping operation on an expression to control the order of execution of the operators in an expression. This operator overrides the automatic precedence order so that the expression within the parentheses is evaluated first. When parentheses are nested, the contents of the inner parentheses are evaluated before the contents of the outer ones.

This is a grouping operator with a precedence level of 5.

Be aware that Lingo allows you to use some commands and functions that take only one argument without parentheses surrounding the argument. When an argument phrase includes an operator, Lingo interprets only the first argument as part of the function, which may confuse Lingo.

For example, the `open window` command allows one argument that specifies which window to open. If you use the `&` operator to define a pathname and file name, Director interprets only the string before the `&` operator as the file name. For example, Lingo interprets the statement `open window the applicationPath & "theMovie"` as `(open window the applicationPath) & ("theMovie")`. Avoid this problem by placing parentheses around the entire phrase that includes an operator, as follows:

    open window (the applicationPath & "theMovie")

Example

These statements use the grouping operator to change the order in which operations occur (the result appears below each statement):

    put (2 + 3) * (4 + 5)
    -- 45
    put 2 + (3 * (4 + 5))
    -- 29
    put 2 + 3 * 4 + 5
    -- 19