I'm using codeacademy to learn java, It's got me doing this text based game, and it works no problems like this: confirm("Press OK when ready"); var age = prompt("What's your age?") if (age>13) {console.log("You may play!")} else {console.log("You may play, but I'm not responsible for any pain brought upon you")} console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'") console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'") var userAnswer = prompt("Do you want to race Bieber on stage?") But when I add this line it doesn't work: if userAnswer = "yes" {console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!")} else{console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")} All together: confirm("Press OK when ready"); var age = prompt("What's your age?") if (age>13) {console.log("You may play!")} else {console.log("You may play, but I'm not responsible for any pain brought upon you")} console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'") console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'"); var userAnswer = prompt("Do you want to race Bieber on stage?"); if userAnswer = "yes" {console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!")} else{console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")} All the console tells me is SyntaxError: Unexpected identifier The if statement that doesn't work seems to be written the same way as the one that does work, but maybe I'm missing something. Any help? Also, this told me nothing about ; Anyone wanna tell me where to put these exactly?
You need parentheses around the condition if (userAnswer = "yes") { stuff } By the way, this is javascript, not java