Precedence and Associativity
This lesson discusses two important characteristics of operators - precedence and associativity.
We'll cover the following...
Precedence
The precedence of an operator determines which operation is performed first in an expression with more than one operators.
Operators are listed below in the order of their precedence from highest to lowest :
- Unary
- Logical/Bitwise NOT -
!
- Derereference -
*
- Borrow -
&
,&mut
- Logical/Bitwise NOT -
- Binary
- Typecast -
as
- Multiplication-
*
,Division -/
, Remainder -%
- Addition -
+
,
- Typecast -