Operator Precedence

Get familiarized with the concepts of operator precedence.

Expressions can be chained with more than one operator. For example, the following line contains four expressions chained with three operators:

a = b + c * d // three operators: =, +, and *

Operator precedence rules specify the order that the chained operators are executed in and the expressions that they use. Operators are executed according to their precedences: first the higher ones, then the lower ones.

The following is D’s operator precedence table. Operators are listed from the highest precedence to the lowest. The ones that are in the same table row have the same precedence. Line wrapping inside table cells is insignificant; for example, == and !is have the same precedence. Unless specified otherwise, operators are left-associative.

Some of the terms used in the table are explained below.

Get hands-on with 1000+ tech skills courses.