Results 1 to 2 of 2
  1. #1
    iamBevan is offline Member
    Join Date
    Oct 2012
    Rep Power

    Default Help with "if" statements

    Hi guys,

    I'm trying to write an if statement with two conditions, then print some text as a result.

    I'm asking the user for a date, between 1 and 31 - and im trying to say "if (variable <1 OR >31)"...what do I need to enter here in place of "or"?

    Obviously, I'm brand new to this - so ANY help would be appreciated :)


  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Help with "if" statements

    You have to use complete boolean expressions. You can't do this:

    if(something < 10 || > 20){...

    Instead, you have to do this:

    if(something < 10 || something > 20){...

    This is covered in the basic tutorials here: Equality, Relational, and Conditional Operators (The Java™ Tutorials > Learning the Java Language > Language Basics)
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 1
    Last Post: 02-01-2012, 09:37 PM
  2. Replies: 4
    Last Post: 10-12-2011, 07:17 AM
  3. I cant figure out my "if "else" statements any help?
    By prendergast36 in forum New To Java
    Replies: 9
    Last Post: 09-17-2011, 12:36 AM
  4. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

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