- #1
gfd43tg
Gold Member
- 950
- 50
Hello, here is a list of the order of precedence for computations when programming, at least in MATLAB
1. Parentheses (starting with innermost pair)
2. NOT (~) (left to right)
3. Arithmetic operations (left to right)
4. Relational operations (left to right)
5. AND (&)
6. OR (|)
7. Short-circuit AND (&&)
8. Short-circuit OR (||)
I was wondering if there is any rhyme or reason for this order, or is it just something that I need to have committed to memory?
1. Parentheses (starting with innermost pair)
2. NOT (~) (left to right)
3. Arithmetic operations (left to right)
4. Relational operations (left to right)
5. AND (&)
6. OR (|)
7. Short-circuit AND (&&)
8. Short-circuit OR (||)
I was wondering if there is any rhyme or reason for this order, or is it just something that I need to have committed to memory?