Code Your Own Adventure2! Logical Operaters, Syntax Error in need of help!


#1

Code Your Own Addventure 2! Logical Operators

I'm getting a syntax error, illegal break statement.
I've looked and it looks to me like all my brackets are closed so I have no idea where I'm going wrong. Any help is greatly appreciated.


var user = prompt("You've got the puck with ten seconds left. Do you PASS, SHOOT, or CHECK?").toUpperCase();
switch(user) {
    case 'PASS':
        var type = prompt("Team player I see, saucer pass or drop pass(SAUCER or DROP)?").toUpperCase();
        if (type === 'DROP') {
            var screen = prompt("Are you screening the goalie(YES or NO).").toUpperCase();
            var open = prompt("Are you open for a pass(YES or NO).").toUpperCase();
            if (screen === 'YES' || open === 'YES') {
                console.log("Way to keep your head in the game! The rebound came right to you and you score!");
            }
             else {
            console.log("You had one but not the other the goalie was able to get onto the puck after the rebound, Game Over");
        }
        }
        else {
            console.log("You saucer pass over to your winger, but you didn't pick your head up and threw it right to the other team for a break away! Game Over...");
        }
        break;


#2

The only issue I found was that you're missing a closing bracket after the break; statement.


#3

Thanks for your help, that wasn't all of the code block but with that I was able to finally find the bracket that was out of place!!


#4

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