2. Code Your Own Adventure


#1

confirm("I am ready to play!");

var age = prompt("What's your age?");

if(age < 13); {
console.log("You are allowed to play but we do not take any responsibility.");
} else {
console.log("Let's play!");
}


I put this code and it says I have a syntax error.


#2
if(age<13); {}

There should be no semi-colon on a line that ends with an open curly bracket.


#3

there shouldn't be anything between your your if (test condition) { block of code } else { block of code } statements


#4

There is nothing between his if and else statements


#5

Thanks guys it worked


#6

the semicolon is between his statements, as you stated
i was showing how the if statement should be formatted. a template
if (test condition) { block of code } else { block of code }


#7

But it could be confusing saying there shouldn't be anything between if and else statements. That makes it sound like he put something like if (test condition) { block of code } (some random code) else { block of code }


#8

you must be misunderstanding what i said... i didn't say "there should be something between"
besides he got the problem now. and i honestly dont know how you could understand it
as to insert a random code in between the if and else when i give the template and say there shouldn't be. :confused:


#9

note that

if(age < 13); {

remove this ; and try again


#10

I have the same problem but I did not put ;. I am stuck. I do not know where I messed up