The following are the order of operations, or precedence rules for arithmetic, logical, and relational operators. Expressions are evaluated left-to-right if they have same precedence.
It is good practice to use parenthesis for those expressions you want evaluated first, or just for better readability in your program.
All the arithmetic operators take the next highest precedence, starting with ** for exponent, then the – sign for unary, and then multiplication *, division /, and modulo %. Next on the list is addition + and subtraction -.
After the arithmetic operators comes the relational, equality, inequality and membership operators. Finally the logical operators come next, with logical NOT having the higher precedence, then the logical AND, and last but not least, the logical OR.
Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Ещё видео!