Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift Basics (retired) Operators Operator Precedence

Hi Amit, on 3.34 in your video you state that x, / and + have the same priority. I thought + is lower in precedence?

Is there an error in the video, because Amit states that + also has same precedence as x, /?

Michael Vilabrera
Michael Vilabrera
Courses Plus Student 11,252 Points

maybe % was intended? You are correct- + & - are lower in precedence. PEMDAS always

J.D. Sandifer
J.D. Sandifer
18,813 Points

Does PEMDAS stand for Parentheses, Exponent, Multiplication, Division, Addition, and Subtraction (in that order)?

I never learned that, but it looks like it would have been helpful.

Reece Pena
Reece Pena
925 Points

PEMDAS does stand for Parentheses, Exponent, Multiplication, Division, Addition, and Subtraction. However some of them have the same level of precedence. So it should be PE(MD)(AS) because Multiplication and Division have the same precedence level, whilst Addition and Subtraction have the same level as well, however Addition and Subtraction or lower than Multiplication and Division. If you have Multiplication and Division in the same equation, then the operator thats closest to the left has supremacy.