View Single Post
Old 11-11-2012, 03:12 AM   PM User | #1
KittenD
New to the CF scene

 
Join Date: Nov 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
KittenD is an unknown quantity at this point
Need help w/ a small adventure game

Hi,
I am wondering if someone can help me with this little problem. I've been struggling with this small section of code below for the last two days. When I run the code i get a syntax error and also another one that says missing operand; found else. What I am trying to do is depending on age, go to "you can play" if your over 18, and "You can't play" if your under 18. I've exhausted all resources and asked around. Everyone tells me that it is fine. But if it is then why is it not running the way it should? Any ideas? Thanks.

Code:
confirm("I am ready to play!")
age = prompt("How old are you?");
if(age > 18); 
{
	console.log("You can play!");
}
 else
{
	console.log("You can't play!");
}
KittenD is offline   Reply With Quote