Lost viking level help pls


#1

So my switch works at first however when it’s supposed to switch the second time and start going north again it starts one step too soon. No matter how much I look at my code I can’t seem to figure it out. Can anyone else see what I’ve done wrong?

// Increment steps and sideSteps as appropriate, taking into account the special rules.
steps++;
if(steps%(SWITCH+1) === 0){
    s =- s;
}


if(s == -1){
    sideSteps--;
}if(s == 1){
    sideSteps++;
}
if(sideSteps - 1 < 1){
    sideSteps = 10;
}else if(sideSteps + 1 > SLIDE){
    sideSteps = 1;
}
if(steps%(SKIP+1) === 0 && s == -1){
    sideSteps--;
}if(steps%(SKIP+1) === 0 && s == 1){
    sideSteps++;
}   
this.say(sideSteps);
this.say(steps);    

}


#2

Please read the FAQ to learn how to post your code correctly. At the moment it is very hard to read and not likely to receive any help. Also you have a huge white-space block there, might want to get rid of that.

Please do not use a new post but edit your old one!


#3

May i please get some help? sorry im only 12 jk im actually 9