ParenthesizedExpr

An expression sequence enclosed in parentheses.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

ParenthesizedExpr

graphics/ParenthesizedExpr.png

ExprSequence

Description

You can use a ParenthesizedExpr to control the order of evaluation in an expression with multiple operators.

A ParenthesizedExpr can also server as a sequence constructor, i.e. the parentheses can contain zero or more expressions that comprise a sequence.

Example

  • The following two queries have different results:

    (count(input()/bib/book) +
        count(input()/reviews/entry)) * 2
    
    count(input()/bib/book) +  count(input()/reviews/entry) * 2

    In the first query the addition operator is evaluated before the multiplication operator because of the parentheses. In the second query no parentheses are used so the multiplication operator is evaluated first.