Results 1 to 3 of 3
  1. #1
    Grady1346 is offline Member
    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    Unhappy Whats wrong with my code

    Yes I am aware that I am sucky but learning, and cannot for the life of me figure out what is wrong here. Any help is much appreciated. Something is wrong with the else part of this... I think?


    confirm("Are you ready to play");
    var age = prompt("What's your age?");
    if (age < 18);
    {
    console.log("You are allowed to play but we accept no responsibility");
    }
    else
    {
    console.log("play on");
    }

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,620
    Rep Power
    5

    Default Re: Whats wrong with my code

    Well, this looks like JavaScript and not Java. But I would get rid of the semi-colon after the if statement.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,254
    Rep Power
    19

    Default Re: Whats wrong with my code

    I'm closing this off topic thread. If you have a Java question, you may start a new thread. But before that, go through the following links:
    Forum Rules -- particularly the third paragraph
    Guide For New Members
    BB Code List - Java Programming Forum - Learn Java Programming

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. whats wrong with this code?
    By Petee in forum New To Java
    Replies: 8
    Last Post: 09-30-2011, 04:39 PM
  2. whats wrong with my code
    By naved in forum New To Java
    Replies: 5
    Last Post: 07-15-2011, 02:06 AM
  3. whats wrong with my code?
    By beandip408 in forum New To Java
    Replies: 6
    Last Post: 11-03-2010, 12:01 AM
  4. Whats wrong with this code?
    By bbtgirl in forum New To Java
    Replies: 2
    Last Post: 02-25-2009, 03:51 AM
  5. Whats wrong with my code???
    By Soda in forum New To Java
    Replies: 2
    Last Post: 12-06-2007, 12:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •