Weird error message



I am receiving a funny but weird error message in my code. It says, "Oops, try again. You printed Fizzbuzz when you should have printed Fizzbuzz.

I looked at another article in which they had the correct answer, but for some reason although both programs are the same, their program works and mine does not.

Please help A.S.A.P.

Thanks in advance!

P.S. The first piece of code is the one that I found elsewhere, and the second is the one that I made.


    else if(i%3===0){

    else if(i%5===0){


for (i = 1; i < 21; i++) {
    if ( (i % 5 === 0) && (i % 3 === 0) ) {
    else if (i % 5 === 0) {
    else if (i % 3 === 0) {
    else {


Why are you using 2 FOR-loops ????


I said in there, the first one is the one that I found elsewhere. I was looking for help in finding out why the two were different.


It seems your missing many semi-colons also spacing sometimes helps for readability when debugging esspecially


nevermind i was mistaken


try using nested if statements


I tried the nested if-statements idea, and it worked! Thank you very much! I would have never thought of that myself.


But the problem was you using

1st FOR loop


in the 2nd


as was mentioned in the Oops-message
Oops, try again. You printed Fizzbuzz when you should have printed FizzBuzz.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.