Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By sunde887

Thread: if (!weekday || vacation) ?

  1. #1
    Join Date
    Jul 2011
    Posts
    47
    Rep Power
    0

    Default if (!weekday || vacation) ?

    what is this statement mean?
    if (!weekday || vacation)

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  3. #3
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    It means if weekday is not true, or vacation is true, enter the if statement.

    Rather than doing
    Java Code:
    if(booleanVariable==true)
    You can instead simply type

    Java Code:
    if(booleanVariable)
    Adding a ! To the front of the variable negates the Boolean variable, so instead of booleanVariable==false, you can type simply !booleanVariable

    The || is the or operator. If either of the conditions is true, it evaluates to true.
    JeffGrigg likes this.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    The || is the or operator. If either of the conditions is true, it evaluates to true.
    <nitpick> If the first condition is false, it evaluates to false without evaluating the second condition. If the first condition is true, it evaluates to the second condition. </nitpick>

    db

Similar Threads

  1. 3-week vacation creative project
    By MGhareeb in forum New To Java
    Replies: 3
    Last Post: 01-24-2011, 06:24 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
  •