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

Help with remainder questions?

I understand most of this topic but i don't understand the remainder questions.

3 Answers

Daniel Sattler
Daniel Sattler
4,867 Points

remainder is basically math.. in this case division. you divide one number by another and get an reminder.

Example:

2 % 2

returns you an reminder of 0 ( 2 / 2 = 1 and no reminder)

3 % 2

returns you an reminder of 1 ( 3 / 2 = 1.5 so in this case reminder 1)

ok this explanation maybe is a bit confusing... letΒ΄s put it this way:

45 % 33

returns you an reminder of 12... why? 33 fits one time in 45 and you have 12 left... your reminder...

I apologize if i explain this maybe a little bit complicated, but i hope you can see the pattern.

Oh... So the % symbol means divide by THEN find the remainder. Okay I get it, Thanks!

It's not that complicated! : )

Hi Daniel, I was just wondering do you own a premium account? Is it worth getting? I wan't to be able to make iPhone games and publish them to the apps store. Will it work for me?