FizzBuzz Path: Help Please!

I’m sure I did the code right, but it’s still not working. Could anyone help me please? I’ll show you my code

let steps = 1;
while (true) {
    // If the number of steps is divisible by 3 AND by 5 -- move to North-West.
    if (steps % 3 === 0 && steps & 5 === 0) {
        hero.moveXY(hero.pos.x - 10, hero.pos.y + 10);
    }   
    // Else if the number of steps is divisible by 3 -- move to East.
    else if (steps % 3 === 0) {
        hero.moveXY(hero.pos.x + 10, hero.pos.y);
    }    
    // Else if the number of steps is divisible by 5 -- move to West.
    else if (steps % 5 === 0) {
        hero.moveXY(hero.pos.x - 10, hero.pos.y);
    }    
    // Else move to North.
    else {
        hero.moveXY(hero.pos.x, hero.pos.y + 10);
    }
    hero.moveXY(hero.pos.x, hero.pos.y + 10);
    steps += 1;
}

& Should be % on line 4

Oops. I could have figured that out, but it is still doing just going straight and running into a coin bomb.

I forget what this level is about, but is the second line of this code supposed to be there after the else statement?

I noticed that too. I’ll delete it to see what happens.

Thanks a ton! I deleted it and it worked! :+1:

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