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

Steve Pham
Steve Pham
1,488 Points

i want create a game "FizzBuzz" and i need someone teach me.and i don't know know this "%" what mean?.Thank You all

Create "Fizzbuzz"

4 Answers

Daniel Sattler
Daniel Sattler
4,867 Points

I know what "other Way" means lol... :-D

My question was more what YOU mean by other way. What is wrong with THIS way?

The best would be to explain WHAT you actually try to archive.

greetings

Steve Pham
Steve Pham
1,488 Points

Okey thank you so much :)

Daniel Sattler
Daniel Sattler
4,867 Points

% Symbol represents a reminder check.

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...

Regarding FizzBuzz...

for i in 1...100 {

if (i % 3 == 0) && (i % 5 == 0) {
      // This is Fizz Buzz
} else if (i % == 0) {
    // This is Fizz
} else if (i % 5 == 0) {
   // This is Buzz
} else {
  // This is nothing
}
}

I hope this leads you in the right direction ;-)

Daniel Sattler
Daniel Sattler
4,867 Points

What you mean by "other way" ?

This is a very compact and easy way.

What do you try to archive? Maybe i can show you another way based on that.

Steve Pham
Steve Pham
1,488 Points

Sorry my Eng sometime not good "other way" that mean different way. If you have some different way can you show me.Thank

Steve Pham
Steve Pham
1,488 Points

Ok thank you.and i'm know "%" what mean ,but i'm want find the other way to create "FizzBuzz" can you help me find other way .Thank you