Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: syntax error

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default syntax error

    confirm("Are you ready to play?");
    var age = prompt("What is your age");

    if(age is less than 13);
    {
    console.log("You are allowed to play but we take no responsibility.");
    }
    else {
    console.log("Get ready for fun!");
    }



    Ihave no idea whats wrong sorry if its a no brainer im a super beginner


  2. #2
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: syntax error

    Well, without knowing what is going on it's impossible
    to say. From what you have posted there are multiple errors.

    Can you post the whole code - including any error messages?

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: syntax error

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly using code or highlight tags per the above link.

    This is not a Java statement:

    if(age is less than 13);

    but if it were, the semicolon at the end would terminate the if() statement and the code in the following clause would execute regardless the if() statement's result.

Similar Threads

  1. Syntax error!!!
    By Gerock7 in forum What's Wrong With My Code?
    Replies: 23
    Last Post: April 22nd, 2014, 07:14 PM
  2. Syntax error
    By Kez in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 19th, 2014, 04:48 PM
  3. Please help not sure how to get past the Syntax error
    By KnightC in forum Other Programming Languages
    Replies: 2
    Last Post: December 23rd, 2011, 10:09 AM
  4. Syntax error with dispose()
    By jagnat in forum AWT / Java Swing
    Replies: 1
    Last Post: October 14th, 2011, 11:00 AM
  5. do while syntax error problem
    By derekxec in forum What's Wrong With My Code?
    Replies: 5
    Last Post: July 1st, 2011, 06:30 PM